(42 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Int.get_bit 3 2026-01-19 "Tomo man-pages"6 .SH NAME7 Int.get_bit \- check whether a bit is set8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Int.get_bit\ :\ func(i:\ Int,\ bit_index:\ Int\ ->\ Bool)13 .fi14 .SH DESCRIPTION15 In the binary representation of an integer, check whether a given bit index is set to 1 or not.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx23 l l l.24 Name Type Description25 i Int The integer whose bits are being inspected.26 bit_index Int The index of the bit to check (1-indexed).27 .TE28 .SH RETURN29 Whether or not the given bit index is set to 1 in the binary representation of the integer.31 .SH NOTES32 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.34 .SH EXAMPLES35 .EX36 assert 6.get_bit(1) == no37 assert 6.get_bit(2) == yes38 assert 6.get_bit(3) == yes39 assert 6.get_bit(4) == no40 .EE41 .SH SEE ALSO42 .BR Tomo-Int (3)