path: root/array.h
diff options
authorFelix von Leitner <>2003-08-22 15:03:10 +0000
committerFelix von Leitner <>2003-08-22 15:03:10 +0000
commit7a18b91761a5a6ea9be032be29922410fe5e1fe0 (patch)
tree1f20a80622bb1125c06e10d936237fc7942a8f6e /array.h
parentc3d62bbd0c564cd888177736656a5dff19f85f59 (diff)
add API for integer multiplication with overflow detection
Diffstat (limited to 'array.h')
1 files changed, 33 insertions, 0 deletions
diff --git a/array.h b/array.h
new file mode 100644
index 0000000..4d5d966
--- /dev/null
+++ b/array.h
@@ -0,0 +1,33 @@
+#ifndef _ARRAY_H
+#define _ARRAY_H
+#include "uint64.h"
+#include <errno.h>
+typedef struct {
+ char* p;
+ int64 allocated, initialized; /* in bytes */
+ /* p and allocated nonzero: array is allocated */
+ /* p zero: array is unallocated */
+ /* allocated < 0: array is failed */
+} array;
+void* array_allocate(array* x,int64 membersize,int64 pos);
+void* array_get(array* x,int64 membersize,int64 pos);
+void* array_start(const array* const x);
+int64 array_length(const array* const x,int64 membersize);
+int64 array_bytes(const array* const x);
+void array_truncate(array* x,int64 membersize,int64 len);
+void array_trunc(array* x);
+void array_reset(array* x);
+void array_fail(array* x);
+int array_equal(const array* const x,const array* const y);
+void array_cat(array* to,const array* const from);
+void array_catb(array* to,const char* from,int64 len);
+void array_cats(array* to,const char* from);
+void array_cats0(array* to,const char* from);
+void array_cat0(array* to);
+void array_cate(array* to,const array* const from,int64 pos,int64 stop);