#include <byte.h>
byte_copy(out,len,in);
byte_copyr(out,len,in);
byte_zero(out,len);
char *out;
char *in;
unsigned int len;
byte_copy copies
in[0] to out[0],
in[1] to out[1],
etc.,
and finally
in[len-1] to out[len-1].
byte_copyr copies in[len-1] to out[len-1], in[len-2] to out[len-2], etc., and finally in[0] to out[0].
byte_zero sets out[0], out[1], ... out[len-1] to 0.
#include <byte.h>
result = byte_equal(one,len,two);
result = byte_diff(one,len,two);
char *one;
char *two;
unsigned int len;
int result;
byte_diff
returns negative, 0, or positive,
depending on whether the string
one[0],
one[1],
...
one[len-1]
is lexicographically smaller than, equal to, or greater than
the string
two[0],
two[1],
...
two[len-1].
byte_equal returns 1 if the strings are equal, 0 otherwise.
When the strings are different, byte_diff and byte_equal do not read bytes past the first difference.
#include <byte.h>
result = byte_chr(one,len,c);
result = byte_rchr(one,len,c);
char *one;
int c;
unsigned int len;
unsigned int result;
byte_chr returns
the smallest integer i
between 0 and len-1 inclusive
such that one[i] equals (char) c.
If no such integer exists,
byte_chr returns len.
byte_rchr returns the largest integer i between 0 and len-1 inclusive such that one[i] equals (char) c. If no such integer exists, byte_rchr returns len.
byte_chr and byte_rchr may read all the bytes one[0], one[1], ... one[len-1], even if not all the bytes are relevant to the answer.