code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(42 lines)
1 '\" t
2 .\" Copyright (c) 2025 Bruce Hill
3 .\" All rights reserved.
4 .\"
5 .TH Byte.get_bit 3 2025-11-29 "Tomo man-pages"
6 .SH NAME
7 Byte.get_bit \- check whether a bit is set
8 .SH LIBRARY
9 Tomo Standard Library
10 .SH SYNOPSIS
11 .nf
12 .BI Byte.get_bit\ :\ func(i:\ Byte,\ bit_index:\ Int\ ->\ Bool)
13 .fi
14 .SH DESCRIPTION
15 In the binary representation of a byte, check whether a given bit index is set to 1 or not.
18 .SH ARGUMENTS
20 .TS
21 allbox;
22 lb lb lbx
23 l l l.
24 Name Type Description
25 i Byte The byte whose bits are being inspected.
26 bit_index Int The index of the bit to check (1-indexed, range 1-8).
27 .TE
28 .SH RETURN
29 Whether or not the given bit index is set to 1 in the byte.
31 .SH NOTES
32 The bit index must be between 1-8 or a runtime error will be produced.
34 .SH EXAMPLES
35 .EX
36 assert Byte(6).get_bit(1) == no
37 assert Byte(6).get_bit(2) == yes
38 assert Byte(6).get_bit(3) == yes
39 assert Byte(6).get_bit(4) == no
40 .EE
41 .SH SEE ALSO
42 .BR Tomo-Byte (3)