1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
.TH qlibs byte 3
.SH NAME
byte \- byte manipulation/evaluation
.SH SYNTAX
.B #include \(dqbyte.h\(dq
unsigned int \fBbyte_chr\fP(const char *\fIhaystack\fR,unsigned int \fIlen\fR,char \fIneedle\fR);
.br
unsigned int \fBbyte_rchr\fP(const char *\fIhaystack\fR,unsigned int \fIlen\fR,char \fIneedle\fR);
void \fBbyte_copy\fP(char *\fIout\fR,unsigned int \fIlen\fR,const char *\fIin\fR);
.br
void \fBbyte_copyr\fP(char *\fIout\fR,unsigned int \fIlen\fR,const char *\fIin\fR);
int \fBbyte_diff\fP(const char *\fIone\fR,unsigned int \fIlen\fR,const char *\fItwo\fR);
int \fBbyte_equal\fP(const char *\fIone\fR,unsigned int \fIlen\fR,const char *\fItwo\fR);
void \fBbyte_fill\fP(char *\fIout\fR,unsigned int \fIlen\fR,const char \fIc\fR);
.br
void \fBbyte_zero\fP(char *\fIout\fR,unsigned int \fIlen\fR);
.SH DESCRIPTION
.B byte_chr
returns the smallest integer \fIi\fR between 0 and
\fIlen\fR-1 inclusive such that \fIone\fR[\fIi\fR] equals \fIneedle\fR.
If no such integer exists,
.B byte_chr
returns \fIlen\fR.
.B byte_chr
may read all bytes \fIone\fR[0], \fIone\fR[1], ...,
\fIone\fR[\fIlen\fR-1], even if not all the bytes are relevant to the
answer.
.B byte_rchr
returns the largest integer \fIi\fR between 0 and
\fIlen\fR-1 inclusive such that \fIone\fR[\fIi\fR] equals \fIneedle\fR.
If no such integer exists,
.B byte_rchr
returns \fIlen\fR.
.B byte_rchr
may read all bytes \fIone\fR[0], \fIone\fR[1], ...,
\fIone\fR[\fIlen\fR-1], even if not all the bytes are relevant to the
answer.
.B byte_copy
copies \fIin\fR[0] to \fIout\fR[0], \fIin\fR[1] to
\fIout\fR[1], etc., and finally \fIin\fR[\fIlen\fR-1] to
\fIout\fR[\fIlen\fR-1].
.B byte_copyr
copies \fIin\fR[\fIlen\fR-1] to \fIout\fR[\fIlen\fR-1],
\fIin\fR[\fIlen\fR-2] to \fIout\fR[\fIlen\fR-2], etc., and
\fIin\fR[0] to \fIout\fR[0].
.B byte_diff
returns negative, 0, or positive, depending on whether
the string \fIone\fR[0], \fIone\fR[1], ..., \fIone\fR[\fIlen\fR-1] is
lexicographically smaller than, equal to, or greater than the string
\fIone\fR[0], \fIone\fR[1], ..., \fIone\fR[\fIlen\fR-1].
When the strings are different,
.B byte_diff
does not read bytes past the first difference.
.B byte_equal
returns
.I 1
if the strings are equal,
.I 0
otherwise.
When the strings are different,
.B byte_equal
does not read bytes past the first difference.
.B byte_fill
fills \fIout\fR[0], \fIout\fR[1], ..., \fIout\fR[\fIlen\fR-1]
with a single byte \fIc\fR.
.B byte_zero
sets \fIout\fR[0], \fIout\fR[1], ..., \fIout\fR[\fIlen\fR-1] to 0.
.SH "SEE ALSO"
case(3),
stralloc(3)
|