commit f0269812459bd5753d344fc1c170b52d6df276a0
parent 193dd4032e8088ada2dc9dcedab8d7486e9305f5
Author: lash <dev@holbrook.no>
Date: Wed, 17 Apr 2024 18:43:14 +0100
Add docs
Diffstat:
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/endian.c b/src/endian.c
@@ -21,7 +21,6 @@ void flip_endian(int l, void *v) {
}
}
-// convert unsigned integer to little-endian representation
int to_endian(char direction, int l, void *n) {
union le un;
diff --git a/src/endian.h b/src/endian.h
@@ -16,7 +16,6 @@ union le {
unsigned char *c;
};
-//int le(int l, void *n);
/*
* Return true (1) if system is little-endian.
*/
diff --git a/src/strip.h b/src/strip.h
@@ -1,7 +1,25 @@
#ifndef LASH_BYTES_H_
#define LASH_BYTES_H_
+/**
+ * strip zero value zeros from a big-endian integer array
+ *
+ * \param value integer data to strip zeros from.
+ * \parmm len pointer to length of input integer data. Length of stripped integer will be written here.
+ * \return pointer to position in buffer containing the stripped integer data.
+ *
+ */
char* strip_be(char *value, size_t *len);
+/**
+ * expand a truncated signed big-endian integer to full bitsize
+ *
+ * \param in integer data to expand.
+ * \param in_len length of input integer.
+ * \param out output buffer where expanded integer will be written.
+ * \param out_len output buffer capacity.
+ * \return 0 if successfully written, 1 on any failure.
+ *
+ */
int strap_be(const char *in, size_t in_len, char *out, size_t out_len);
#endif