package tezos-protocol-alpha
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/tezos_raw_protocol_alpha/Tezos_raw_protocol_alpha/Script_bytes/index.html
Module Tezos_raw_protocol_alpha.Script_bytes
Source
Semantics of logical and bit-shift operators for bytes
bytes_or a b
returns the logical or'ed bytes of a
and b
. If the arguments have different lengths, the shorter one is 0-padded on the left before the logical operation. For example:
0x1200 OR 0x34 = 0x1200 OR 0x0034 = 0x1234 0x0012 OR 0xff = 0x0012 OR 0x00ff = 0x00ff (instead of 0xff)
bytes_and a b
returns the logical and'ed bytes of a
and b
. If the arguments have different lengths, the prefix of the longer one is removed to have the same length as the shorter one before the logical operation. For example:
0x1234 AND 0x30 = 0x34 AND 0x30 = 0x30 0x12f00f AND 0x0fff = 0xf00f AND 0x0fff = 0x000f (instead of 0x0f)
bytes_xor a b
returns the logical xor'ed bytes of a
and b
. If the arguments have different lengths, the shorter one is 0-padded on the left before the logical operation. For example:
0x1200 XOR 0x34 = 0x1200 XOR 0x0034 = 0x1234 0x0012 XOR 0xff = 0x0012 XOR 0x00ff = 0x00ed (instead of 0xed)
bytes_not a
returns the logical not'ed bytes of a
with the same length of a
. For example:
NOT 0xff00 = 0x00ff (instead of 0xff)
bytes_lsl bytes bits
returns the bits
left shifted bytes of bytes
. If bits
is more than 64000, it returns None
.
The function always returns a longer bytes of the input if bits
is not 0. For example:
0x12 LSL 1 = 0x0024 (instead of 0x24) 0x0012 LSL 9 = 0x00002400 (instead of 0x002400 or 0x2400)
bytes_lsr bytes bits
returns the bits
right shifted bytes of bytes
.
0x1234 LSR 1 = 0x091a 0x1234 LSR 8 = 0x12 (instead of 0x0012)
Convert a natural number to bytes using big-endian encoding.
Convert bytes to a natural number using big-endian encoding.
Convert an integer to bytes using big-endian encoding. Negative numbers are handled by two's-complement.
Convert bytes to an integer using big-endian encoding. Negative numbers are handled by two's-complement.