aboutsummaryrefslogtreecommitdiff
path: root/api/bytes.yaml
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-07-10 14:45:07 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-07-10 14:45:07 -0400
commit394da24c854fdd2dc08e37090263972b732f5424 (patch)
tree5fafbf0b64b0883d176418747b45b7d8316ca6c9 /api/bytes.yaml
parent39501916acc08208360d9f920af425d0e8e230bb (diff)
parentcd1e9b5fd52dbc993463d58c41895aba9cd78966 (diff)
Merge branch 'main' into decimals
Diffstat (limited to 'api/bytes.yaml')
-rw-r--r--api/bytes.yaml30
1 files changed, 30 insertions, 0 deletions
diff --git a/api/bytes.yaml b/api/bytes.yaml
index 52f48528..2785513d 100644
--- a/api/bytes.yaml
+++ b/api/bytes.yaml
@@ -1,3 +1,33 @@
+Byte.get_bit:
+ short: check whether a bit is set
+ description: >
+ In the binary representation of a byte, check whether a given bit index is
+ set to 1 or not.
+ note: >
+ The bit index must be between 1-8 or a runtime error will be produced.
+ return:
+ type: 'Bool'
+ description: >
+ Whether or not the given bit index is set to 1 in the byte.
+ args:
+ i:
+ type: 'Byte'
+ description: >
+ The byte whose bits are being inspected.
+ bit_index:
+ type: 'Int'
+ description: >
+ The index of the bit to check (1-indexed, range 1-8).
+ example: |
+ >> Byte(6).get_bit(1)
+ = no
+ >> Byte(6).get_bit(2)
+ = yes
+ >> Byte(6).get_bit(3)
+ = yes
+ >> Byte(6).get_bit(4)
+ = no
+
Byte.hex:
short: convert to hexidecimal
description: >