|
@@ -1,152 +0,0 @@
|
|
|
-#ifndef CX_ZIVUOS_VECTOR_HELPERS_H_INCLUDED
|
|
|
|
|
-#define CX_ZIVUOS_VECTOR_HELPERS_H_INCLUDED
|
|
|
|
|
-
|
|
|
|
|
-#include <stdint.h>
|
|
|
|
|
-#include <stddef.h>
|
|
|
|
|
-#include <stdbool.h>
|
|
|
|
|
-
|
|
|
|
|
-#include "models.h"
|
|
|
|
|
-#include "vector.h"
|
|
|
|
|
-
|
|
|
|
|
-static inline uintptr_t zv_vector_get_unumber(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_get(self, count).unumber;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline intptr_t zv_vector_get_number(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_get(self, count).number;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline void * zv_vector_get_pointer(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_get(self, count).pointer;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline char * zv_vector_get_cstring(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_get(self, count).cstring;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline size_t zv_vector_push_unumber(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- uintptr_t unumber
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t target;
|
|
|
|
|
- target.unumber = unumber;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_push(self, target);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline size_t zv_vector_push_number(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- intptr_t number
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t target;
|
|
|
|
|
- target.number = number;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_push(self, target);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline size_t zv_vector_push_pointer(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- void *pointer
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t target;
|
|
|
|
|
- target.pointer = pointer;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_push(self, target);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline size_t zv_vector_push_cstring(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- char *cstring
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t target;
|
|
|
|
|
- target.cstring = cstring;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_push(self, target);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline uintptr_t zv_vector_pop_unumber(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_pop(self, count).unumber;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline intptr_t zv_vector_pop_number(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_pop(self, count).number;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline void * zv_vector_pop_pointer(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_pop(self, count).pointer;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline char * zv_vector_pop_cstring(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- return zv_vector_pop(self, count).cstring;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline bool zv_vector_insert_unumber(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- uintptr_t target,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t translator;
|
|
|
|
|
- translator.unumber = target;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_insert(self, translator, count);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline bool zv_vector_insert_number(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- intptr_t target,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t translator;
|
|
|
|
|
- translator.number = target;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_insert(self, translator, count);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline bool zv_vector_insert_pointer(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- void *target,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t translator;
|
|
|
|
|
- translator.pointer = target;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_insert(self, translator, count);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static inline bool zv_vector_insert_cstring(
|
|
|
|
|
- zv_vector_t *self,
|
|
|
|
|
- char *target,
|
|
|
|
|
- size_t count
|
|
|
|
|
-) {
|
|
|
|
|
- zv_universal_t translator;
|
|
|
|
|
- translator.cstring = target;
|
|
|
|
|
-
|
|
|
|
|
- return zv_vector_insert(self, translator, count);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|