ref: e3a9307d99e1a2936e63b6ffa5d80a5929d4b549
dir: /lib/std/getint.myr/
pkg std =
generic getle64 : (buf : byte[:] -> @a::(numeric,integral))
generic getbe64 : (buf : byte[:] -> @a::(numeric,integral))
generic getle32 : (buf : byte[:] -> @a::(numeric,integral))
generic getbe32 : (buf : byte[:] -> @a::(numeric,integral))
generic getle16 : (buf : byte[:] -> @a::(numeric,integral))
generic getbe16 : (buf : byte[:] -> @a::(numeric,integral))
generic getle8 : (buf : byte[:] -> @a::(numeric,integral))
generic getbe8 : (buf : byte[:] -> @a::(numeric,integral))
;;
generic getbe64 = {buf -> @a::(numeric,integral)
-> ((buf[0] : @a::(numeric,integral)) << 56) | \
((buf[1] : @a::(numeric,integral)) << 48) | \
((buf[2] : @a::(numeric,integral)) << 40) | \
((buf[3] : @a::(numeric,integral)) << 32) | \
((buf[4] : @a::(numeric,integral)) << 24) | \
((buf[5] : @a::(numeric,integral)) << 16) | \
((buf[6] : @a::(numeric,integral)) << 8) | \
((buf[7] : @a::(numeric,integral)) << 0)
}
generic getle64 = {buf
-> ((buf[0] : @a::(numeric,integral)) << 0) | \
((buf[1] : @a::(numeric,integral)) << 8) | \
((buf[2] : @a::(numeric,integral)) << 16) | \
((buf[3] : @a::(numeric,integral)) << 24) | \
((buf[4] : @a::(numeric,integral)) << 32) | \
((buf[5] : @a::(numeric,integral)) << 40) | \
((buf[6] : @a::(numeric,integral)) << 48) | \
((buf[7] : @a::(numeric,integral)) << 56)
}
generic getbe32 = {buf
-> ((buf[0] : @a::(numeric,integral)) << 24) | \
((buf[1] : @a::(numeric,integral)) << 16) | \
((buf[2] : @a::(numeric,integral)) << 8) | \
((buf[3] : @a::(numeric,integral)) << 0)
}
generic getle32 = {buf
-> ((buf[0] : @a::(numeric,integral)) << 0) | \
((buf[1] : @a::(numeric,integral)) << 8) | \
((buf[2] : @a::(numeric,integral)) << 16) | \
((buf[3] : @a::(numeric,integral)) << 24)
}
generic getbe16 = {buf
-> ((buf[0] : @a::(numeric,integral)) << 8) | \
((buf[1] : @a::(numeric,integral)) << 0)
}
generic getle16 = {buf
-> ((buf[0] : @a::(numeric,integral)) << 0) | \
((buf[1] : @a::(numeric,integral)) << 8)
}
generic getbe8 = {buf
-> (buf[0] : @a::(numeric,integral)) << 0
}
generic getle8 = {buf
-> (buf[0] : @a::(numeric,integral)) << 0
}