src/lib/bytes.bend checks
raw source on the hub · import 0x3c5aa333777d8e9208888ca3a048f4c7/src/lib/bytes.bend as Bytes
2 imports
import Base import ./u64.bend as U
Definitions
def Bytes.zeros source · line 7 · raw
@n:Nat -> List<&2, U32>
def Bytes.le source · line 12 · raw
@n:Nat -> @+x:U32 -> List<&2, U32>
The low n bytes of x, least significant first (n <= 4). The mask comes first
in .&. so that the proofs of the round trips reduce bit by bit.
def Bytes.be source · line 20 · raw
@n:Nat -> @x:U32 -> List<&2, U32>
The low n bytes of x, most significant first (n <= 4).
def Bytes.le16 source · line 23 · raw
@x:U32 -> List<&2, U32>
def Bytes.le32 source · line 26 · raw
@x:U32 -> List<&2, U32>
def Bytes.be32 source · line 29 · raw
@x:U32 -> List<&2, U32>
def Bytes.le64 source · line 32 · raw
@a:0x3c5aa333777d8e9208888ca3a048f4c7/src/lib/u64.U64 -> List<&2, U32>
def Bytes.be64 source · line 37 · raw
@a:0x3c5aa333777d8e9208888ca3a048f4c7/src/lib/u64.U64 -> List<&2, U32>
def Bytes.read_le source · line 43 · raw
@n:Nat -> @bs:List<&2, U32> -> U32
Reads up to 4 bytes little-endian; missing bytes read as zero.
def Bytes.read_be source · line 55 · raw
@+n:Nat -> @bs:List<&2, U32> -> U32
Reads up to 4 bytes big-endian; missing bytes read as zero.
def Bytes.read_le32 source · line 58 · raw
@bs:List<&2, U32> -> U32
def Bytes.read_le16 source · line 61 · raw
@bs:List<&2, U32> -> U32
def Bytes.read_be32 source · line 64 · raw
@bs:List<&2, U32> -> U32
def Bytes.read_le64 source · line 67 · raw
@+bs:List<&2, U32> -> 0x3c5aa333777d8e9208888ca3a048f4c7/src/lib/u64.U64
def Bytes.slice source · line 71 · raw
@bs:List<&2, U32> -> @off:Nat -> @len:Nat -> List<&2, U32>
len bytes starting at off; short when the list ends first.
def Bytes.of_string source · line 75 · raw
@s:String -> List<&2, U32>
The low byte of each character code.
def Bytes.of_cstring source · line 83 · raw
@s:String -> List<&2, U32>
A NUL-terminated C string.
def Bytes.pad_len.fin source · line 86 · raw
@aligned:Bool -> @m:Nat -> @r:Nat -> Nat
def Bytes.pad_len source · line 94 · raw
@k:Nat -> @n:Nat -> Nat
Zero bytes that pad a length n up to a multiple of 2^k.
def Bytes.pad source · line 101 · raw
@k:Nat -> @+bs:List<&2, U32> -> List<&2, U32>
bs followed by zeros up to a multiple of 2^k bytes.