llm
Download
42 lines 1 KiBGroffModified 2026-08-20 raw
123456789101112131415161718192021222324252627282930313233343536373839404142
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Int.get_bit 3 2026-01-19 "Tomo man-pages"
.SH NAME
Int.get_bit \- check whether a bit is set
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Int.get_bit\ :\ func(i:\ Int,\ bit_index:\ Int\ ->\ Bool)
.fi
.SH DESCRIPTION
In the binary representation of an integer, check whether a given bit index is set to 1 or not.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
i	Int	The integer whose bits are being inspected. 
bit_index	Int	The index of the bit to check (1-indexed). 
.TE
.SH RETURN
Whether or not the given bit index is set to 1 in the binary representation of the integer.

.SH NOTES
For fixed-size integers, the bit index must be between 1 and the number of bits in that integer (i.e. 1-64 for `Int64`). For `Int`, the bit index must be between 1 and `Int64.max`. Values outside this range will produce a runtime error.

.SH EXAMPLES
.EX
assert not 6.get_bit(1)
assert 6.get_bit(2)
assert 6.get_bit(3)
assert not 6.get_bit(4)
.EE
.SH SEE ALSO
.BR Tomo-Int (3)