mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Add write_fast_uxx methods
This commit is contained in:
1 parent
57c4196934
commit
732365b80d
14 files changed
+1260
-42
No files matched your search
@@ -87,6 +87,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -169,6 +173,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -116,10 +116,6 @@ func (g *gen) writeBuiltinIO(b *buffer, recv *a.Expr, method t.ID, args []*a.Nod
|
||||
func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []*a.Node, rp replacementPolicy, depth uint32) error {
|
||||
// TODO: don't hard-code the recv being a_src.
|
||||
switch method {
|
||||
case t.IDPeekU8:
|
||||
b.writes("(*ioptr_src)")
|
||||
return nil
|
||||
|
||||
case t.IDSetLimit:
|
||||
b.printf("wuffs_base__io_reader__set_limit(&%ssrc, ioptr_src,", aPrefix)
|
||||
// TODO: update the ioptr variables?
|
||||
@@ -149,8 +145,8 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
}
|
||||
|
||||
if method >= t.IDPeekU8 {
|
||||
if m := method - t.IDPeekU8; m < t.ID(len(peekMethods)) {
|
||||
if method >= peekMethodsBase {
|
||||
if m := method - peekMethodsBase; m < t.ID(len(peekMethods)) {
|
||||
if p := peekMethods[m]; p.n != 0 {
|
||||
b.printf("wuffs_base__load_u%d%ce(ioptr_src)", p.n, p.endianness)
|
||||
return nil
|
||||
@@ -212,6 +208,24 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
}
|
||||
|
||||
if method >= writeFastMethodsBase {
|
||||
if m := method - writeFastMethodsBase; m < t.ID(len(writeFastMethods)) {
|
||||
if p := writeFastMethods[m]; p.n != 0 {
|
||||
// Generate a three part expression using the comma operator:
|
||||
// "(store, pointer increment, return_empty_struct call)". The
|
||||
// final part is a function call (to a static inline function)
|
||||
// instead of a struct literal, to avoid a "expression result
|
||||
// unused" compiler error.
|
||||
b.printf("(wuffs_base__store_u%d%ce(ioptr_dst,", p.n, p.endianness)
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), rp, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
b.printf("), ioptr_dst += %d, wuffs_base__return_empty_struct())", p.n/8)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return g.writeBuiltinIO(b, recv, method, args, rp, depth)
|
||||
}
|
||||
|
||||
@@ -499,23 +513,48 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
return errNoSuchBuiltin
|
||||
}
|
||||
|
||||
const peekMethodsBase = t.IDPeekU8
|
||||
|
||||
var peekMethods = [...]struct {
|
||||
n uint8
|
||||
endianness uint8
|
||||
}{
|
||||
// t.IDPeekU8 is a special case, neither big nor little endian.
|
||||
t.IDPeekU16BE - t.IDPeekU8: {16, 'b'},
|
||||
t.IDPeekU16LE - t.IDPeekU8: {16, 'l'},
|
||||
t.IDPeekU24BE - t.IDPeekU8: {24, 'b'},
|
||||
t.IDPeekU24LE - t.IDPeekU8: {24, 'l'},
|
||||
t.IDPeekU32BE - t.IDPeekU8: {32, 'b'},
|
||||
t.IDPeekU32LE - t.IDPeekU8: {32, 'l'},
|
||||
t.IDPeekU40BE - t.IDPeekU8: {40, 'b'},
|
||||
t.IDPeekU40LE - t.IDPeekU8: {40, 'l'},
|
||||
t.IDPeekU48BE - t.IDPeekU8: {48, 'b'},
|
||||
t.IDPeekU48LE - t.IDPeekU8: {48, 'l'},
|
||||
t.IDPeekU56BE - t.IDPeekU8: {56, 'b'},
|
||||
t.IDPeekU56LE - t.IDPeekU8: {56, 'l'},
|
||||
t.IDPeekU64BE - t.IDPeekU8: {64, 'b'},
|
||||
t.IDPeekU64LE - t.IDPeekU8: {64, 'l'},
|
||||
t.IDPeekU8 - peekMethodsBase: {8, 'b'},
|
||||
t.IDPeekU16BE - peekMethodsBase: {16, 'b'},
|
||||
t.IDPeekU16LE - peekMethodsBase: {16, 'l'},
|
||||
t.IDPeekU24BE - peekMethodsBase: {24, 'b'},
|
||||
t.IDPeekU24LE - peekMethodsBase: {24, 'l'},
|
||||
t.IDPeekU32BE - peekMethodsBase: {32, 'b'},
|
||||
t.IDPeekU32LE - peekMethodsBase: {32, 'l'},
|
||||
t.IDPeekU40BE - peekMethodsBase: {40, 'b'},
|
||||
t.IDPeekU40LE - peekMethodsBase: {40, 'l'},
|
||||
t.IDPeekU48BE - peekMethodsBase: {48, 'b'},
|
||||
t.IDPeekU48LE - peekMethodsBase: {48, 'l'},
|
||||
t.IDPeekU56BE - peekMethodsBase: {56, 'b'},
|
||||
t.IDPeekU56LE - peekMethodsBase: {56, 'l'},
|
||||
t.IDPeekU64BE - peekMethodsBase: {64, 'b'},
|
||||
t.IDPeekU64LE - peekMethodsBase: {64, 'l'},
|
||||
}
|
||||
|
||||
const writeFastMethodsBase = t.IDWriteFastU8
|
||||
|
||||
var writeFastMethods = [...]struct {
|
||||
n uint8
|
||||
endianness uint8
|
||||
}{
|
||||
t.IDWriteFastU8 - writeFastMethodsBase: {8, 'b'},
|
||||
t.IDWriteFastU16BE - writeFastMethodsBase: {16, 'b'},
|
||||
t.IDWriteFastU16LE - writeFastMethodsBase: {16, 'l'},
|
||||
t.IDWriteFastU24BE - writeFastMethodsBase: {24, 'b'},
|
||||
t.IDWriteFastU24LE - writeFastMethodsBase: {24, 'l'},
|
||||
t.IDWriteFastU32BE - writeFastMethodsBase: {32, 'b'},
|
||||
t.IDWriteFastU32LE - writeFastMethodsBase: {32, 'l'},
|
||||
t.IDWriteFastU40BE - writeFastMethodsBase: {40, 'b'},
|
||||
t.IDWriteFastU40LE - writeFastMethodsBase: {40, 'l'},
|
||||
t.IDWriteFastU48BE - writeFastMethodsBase: {48, 'b'},
|
||||
t.IDWriteFastU48LE - writeFastMethodsBase: {48, 'l'},
|
||||
t.IDWriteFastU56BE - writeFastMethodsBase: {56, 'b'},
|
||||
t.IDWriteFastU56LE - writeFastMethodsBase: {56, 'l'},
|
||||
t.IDWriteFastU64BE - writeFastMethodsBase: {64, 'b'},
|
||||
t.IDWriteFastU64LE - writeFastMethodsBase: {64, 'l'},
|
||||
}
|
||||
@@ -112,10 +112,14 @@ const basePrivateH = "" +
|
||||
"UTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (status < 0) { \\\n goto exit; \\\n } else if (status == 0) { \\\n goto ok; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are static, so that linking multiple wuffs .o files won't complain " +
|
||||
"about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {\n return ((wuffs_base__empty_struct){});\n}\n\n" +
|
||||
"" +
|
||||
"// ---------------- Numeric Types\n\nstatic inline uint16_t wuffs_base__load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t wuffs_base__load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t wuffs_base__load_u24be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u24le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16);\n}\n\nstatic inline uint32_t wuffs_base__load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline uint64_t wuffs_base__load_u40be(uint8_t" +
|
||||
"* p) {\n return ((uint64_t)(p[0]) << 32) | ((uint64_t)(p[1]) << 24) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 8) |\n ((uint64_t)(p[4]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u40le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32);\n}\n\nstatic inline uint64_t wuffs_base__load_u48be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) |\n ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) |\n ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u48le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40);\n}\n\nstatic inline uint64_t wuffs_base__load_u56be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 48) | ((uint64_t)(p[1]) << 40) |\n ((u" +
|
||||
"int64_t)(p[2]) << 32) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 16) | ((uint64_t)(p[5]) << 8) |\n ((uint64_t)(p[6]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u56le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) |\n ((uint64_t)(p[6]) << 48);\n}\n\nstatic inline uint64_t wuffs_base__load_u64be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) |\n ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) |\n ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) |\n ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u64le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) |\n ((uint64_t)(p[6]) << " +
|
||||
"48) | ((uint64_t)(p[7]) << 56);\n}\n\n" +
|
||||
"// ---------------- Numeric Types\n\nstatic inline uint8_t wuffs_base__load_u8be(uint8_t* p) {\n return p[0];\n}\n\nstatic inline uint16_t wuffs_base__load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t wuffs_base__load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t wuffs_base__load_u24be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u24le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16);\n}\n\nstatic inline uint32_t wuffs_base__load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t wuffs_base__load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint" +
|
||||
"32_t)(p[3]) << 24);\n}\n\nstatic inline uint64_t wuffs_base__load_u40be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 32) | ((uint64_t)(p[1]) << 24) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 8) |\n ((uint64_t)(p[4]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u40le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32);\n}\n\nstatic inline uint64_t wuffs_base__load_u48be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) |\n ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) |\n ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u48le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40);\n}\n\nstatic inline uint64_t wuffs_base__load_u56be(uint8_t* p) {" +
|
||||
"\n return ((uint64_t)(p[0]) << 48) | ((uint64_t)(p[1]) << 40) |\n ((uint64_t)(p[2]) << 32) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 16) | ((uint64_t)(p[5]) << 8) |\n ((uint64_t)(p[6]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u56le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) |\n ((uint64_t)(p[6]) << 48);\n}\n\nstatic inline uint64_t wuffs_base__load_u64be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 56) | ((uint64_t)(p[1]) << 48) |\n ((uint64_t)(p[2]) << 40) | ((uint64_t)(p[3]) << 32) |\n ((uint64_t)(p[4]) << 24) | ((uint64_t)(p[5]) << 16) |\n ((uint64_t)(p[6]) << 8) | ((uint64_t)(p[7]) << 0);\n}\n\nstatic inline uint64_t wuffs_base__load_u64le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64" +
|
||||
"_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40) |\n ((uint64_t)(p[6]) << 48) | ((uint64_t)(p[7]) << 56);\n}\n\n" +
|
||||
"" +
|
||||
"// --------\n\nstatic inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {\n p[0] = x;\n}\n\nstatic inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {\n p[0] = x >> 8;\n p[1] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n}\n\nstatic inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {\n p[0] = x >> 16;\n p[1] = x >> 8;\n p[2] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n}\n\nstatic inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {\n p[0] = x >> 24;\n p[1] = x >> 16;\n p[2] = x >> 8;\n p[3] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n p[3] = x >> 24;\n}\n\nstatic inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {\n p[0] = x >> 32;\n p[1] = x >> 24;\n p[2] = x >> 16;\n p[3] = x >> 8;\n p[4] = x >> 0;\n}\n\nstatic inline void wuffs_" +
|
||||
"base__store_u40le(uint8_t* p, uint64_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n p[3] = x >> 24;\n p[4] = x >> 32;\n}\n\nstatic inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {\n p[0] = x >> 40;\n p[1] = x >> 32;\n p[2] = x >> 24;\n p[3] = x >> 16;\n p[4] = x >> 8;\n p[5] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n p[3] = x >> 24;\n p[4] = x >> 32;\n p[5] = x >> 40;\n}\n\nstatic inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {\n p[0] = x >> 48;\n p[1] = x >> 40;\n p[2] = x >> 32;\n p[3] = x >> 24;\n p[4] = x >> 16;\n p[5] = x >> 8;\n p[6] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n p[3] = x >> 24;\n p[4] = x >> 32;\n p[5] = x >> 40;\n p[6] = x >> 48;\n}\n\nstatic inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {\n p[0] = x >> 56;\n p[1] = x >> 48;\n p[2] = x >> 40;\n p[3] = x >> 32;\n" +
|
||||
" p[4] = x >> 24;\n p[5] = x >> 16;\n p[6] = x >> 8;\n p[7] = x >> 0;\n}\n\nstatic inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {\n p[0] = x >> 0;\n p[1] = x >> 8;\n p[2] = x >> 16;\n p[3] = x >> 24;\n p[4] = x >> 32;\n p[5] = x >> 40;\n p[6] = x >> 48;\n p[7] = x >> 56;\n}\n\n" +
|
||||
"" +
|
||||
"// --------\n\nstatic inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {\n *x = wuffs_base__u8__sat_add(*x, y);\n}\n\nstatic inline void wuffs_base__u8__sat_sub_indirect(uint8_t* x, uint8_t y) {\n *x = wuffs_base__u8__sat_sub(*x, y);\n}\n\nstatic inline void wuffs_base__u16__sat_add_indirect(uint16_t* x, uint16_t y) {\n *x = wuffs_base__u16__sat_add(*x, y);\n}\n\nstatic inline void wuffs_base__u16__sat_sub_indirect(uint16_t* x, uint16_t y) {\n *x = wuffs_base__u16__sat_sub(*x, y);\n}\n\nstatic inline void wuffs_base__u32__sat_add_indirect(uint32_t* x, uint32_t y) {\n *x = wuffs_base__u32__sat_add(*x, y);\n}\n\nstatic inline void wuffs_base__u32__sat_sub_indirect(uint32_t* x, uint32_t y) {\n *x = wuffs_base__u32__sat_sub(*x, y);\n}\n\nstatic inline void wuffs_base__u64__sat_add_indirect(uint64_t* x, uint64_t y) {\n *x = wuffs_base__u64__sat_add(*x, y);\n}\n\nstatic inline void wuffs_base__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {\n *x = wuffs_base__u64__sat_sub(*x, y);\n}\n\n" +
|
||||
"" +
|
||||
|
||||
+122
@@ -1840,6 +1840,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -1922,6 +1926,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -1908,6 +1908,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -1990,6 +1994,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -1909,6 +1909,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -1991,6 +1995,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -2000,6 +2000,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -2082,6 +2086,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
+122
@@ -2164,6 +2164,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -2246,6 +2250,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -2207,6 +2207,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -2289,6 +2293,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
+122
@@ -1940,6 +1940,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -2022,6 +2026,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -2204,6 +2204,10 @@ static inline wuffs_base__empty_struct wuffs_base__return_empty_struct() {
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
static inline uint8_t wuffs_base__load_u8be(uint8_t* p) {
|
||||
return p[0];
|
||||
}
|
||||
|
||||
static inline uint16_t wuffs_base__load_u16be(uint8_t* p) {
|
||||
return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);
|
||||
}
|
||||
@@ -2286,6 +2290,124 @@ static inline uint64_t wuffs_base__load_u64le(uint8_t* p) {
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__store_u8be(uint8_t* p, uint8_t x) {
|
||||
p[0] = x;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16be(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 8;
|
||||
p[1] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u16le(uint8_t* p, uint16_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 16;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u24le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32be(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 24;
|
||||
p[1] = x >> 16;
|
||||
p[2] = x >> 8;
|
||||
p[3] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u32le(uint8_t* p, uint32_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 32;
|
||||
p[1] = x >> 24;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 8;
|
||||
p[4] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u40le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 40;
|
||||
p[1] = x >> 32;
|
||||
p[2] = x >> 24;
|
||||
p[3] = x >> 16;
|
||||
p[4] = x >> 8;
|
||||
p[5] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u48le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 48;
|
||||
p[1] = x >> 40;
|
||||
p[2] = x >> 32;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 16;
|
||||
p[5] = x >> 8;
|
||||
p[6] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u56le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64be(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 56;
|
||||
p[1] = x >> 48;
|
||||
p[2] = x >> 40;
|
||||
p[3] = x >> 32;
|
||||
p[4] = x >> 24;
|
||||
p[5] = x >> 16;
|
||||
p[6] = x >> 8;
|
||||
p[7] = x >> 0;
|
||||
}
|
||||
|
||||
static inline void wuffs_base__store_u64le(uint8_t* p, uint64_t x) {
|
||||
p[0] = x >> 0;
|
||||
p[1] = x >> 8;
|
||||
p[2] = x >> 16;
|
||||
p[3] = x >> 24;
|
||||
p[4] = x >> 32;
|
||||
p[5] = x >> 40;
|
||||
p[6] = x >> 48;
|
||||
p[7] = x >> 56;
|
||||
}
|
||||
|
||||
// --------
|
||||
|
||||
static inline void wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
@@ -159,6 +159,10 @@ var Funcs = []string{
|
||||
|
||||
// TODO: these should have an explicit precondition "available() >= N". For
|
||||
// now, that's implicitly checked (i.e. hard coded).
|
||||
//
|
||||
// The io_reader has peek_etc methods and skip_fast32, not read_etc_fast,
|
||||
// because we sometimes advance the pointer by less than what's read. See
|
||||
// https://fgiesen.wordpress.com/2018/02/20/reading-bits-in-far-too-many-ways-part-2/
|
||||
"io_reader.peek_u8()(ret u8)",
|
||||
"io_reader.peek_u16be()(ret u16)",
|
||||
"io_reader.peek_u16le()(ret u16)",
|
||||
@@ -208,6 +212,27 @@ var Funcs = []string{
|
||||
"io_writer.write_u64be?(x u64)()",
|
||||
"io_writer.write_u64le?(x u64)()",
|
||||
|
||||
// TODO: these should have an explicit precondition "available() >= N". For
|
||||
// now, that's implicitly checked (i.e. hard coded).
|
||||
//
|
||||
// The io_writer has write_fast_etc methods, not poke_etc and skip_fast32,
|
||||
// because skip32_fast could leave uninitialized bytes in the io_buffer.
|
||||
"io_writer.write_fast_u8!(x u8)()",
|
||||
"io_writer.write_fast_u16be!(x u16)()",
|
||||
"io_writer.write_fast_u16le!(x u16)()",
|
||||
"io_writer.write_fast_u24be!(x u32[..0xFFFFFF])()",
|
||||
"io_writer.write_fast_u24le!(x u32[..0xFFFFFF])()",
|
||||
"io_writer.write_fast_u32be!(x u32)()",
|
||||
"io_writer.write_fast_u32le!(x u32)()",
|
||||
"io_writer.write_fast_u40be!(x u64[..0xFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u40le!(x u64[..0xFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u48be!(x u64[..0xFFFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u48le!(x u64[..0xFFFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u56be!(x u64[..0xFFFFFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u56le!(x u64[..0xFFFFFFFFFFFFFF])()",
|
||||
"io_writer.write_fast_u64be!(x u64)()",
|
||||
"io_writer.write_fast_u64le!(x u64)()",
|
||||
|
||||
"io_writer.available()(ret u64)",
|
||||
"io_writer.set!(s slice u8)()",
|
||||
"io_writer.set_limit!(l u64)()",
|
||||
|
||||
+37
-17
@@ -1005,7 +1005,8 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (a.Bounds,
|
||||
|
||||
} else if method >= t.IDPeekU8 {
|
||||
if m := method - t.IDPeekU8; m < t.ID(len(ioMethodAdvances)) {
|
||||
advance, update = ioMethodAdvances[m], false
|
||||
au := ioMethodAdvances[m]
|
||||
advance, update = au.advance, au.update
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,22 +1023,41 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (a.Bounds,
|
||||
return a.Bounds{}, errNotASpecialCase
|
||||
}
|
||||
|
||||
var ioMethodAdvances = [...]*big.Int{
|
||||
t.IDPeekU8 - t.IDPeekU8: one,
|
||||
t.IDPeekU16BE - t.IDPeekU8: two,
|
||||
t.IDPeekU16LE - t.IDPeekU8: two,
|
||||
t.IDPeekU24BE - t.IDPeekU8: three,
|
||||
t.IDPeekU24LE - t.IDPeekU8: three,
|
||||
t.IDPeekU32BE - t.IDPeekU8: four,
|
||||
t.IDPeekU32LE - t.IDPeekU8: four,
|
||||
t.IDPeekU40BE - t.IDPeekU8: five,
|
||||
t.IDPeekU40LE - t.IDPeekU8: five,
|
||||
t.IDPeekU48BE - t.IDPeekU8: six,
|
||||
t.IDPeekU48LE - t.IDPeekU8: six,
|
||||
t.IDPeekU56BE - t.IDPeekU8: seven,
|
||||
t.IDPeekU56LE - t.IDPeekU8: seven,
|
||||
t.IDPeekU64BE - t.IDPeekU8: eight,
|
||||
t.IDPeekU64LE - t.IDPeekU8: eight,
|
||||
var ioMethodAdvances = [...]struct {
|
||||
advance *big.Int
|
||||
update bool
|
||||
}{
|
||||
t.IDPeekU8 - t.IDPeekU8: {one, false},
|
||||
t.IDPeekU16BE - t.IDPeekU8: {two, false},
|
||||
t.IDPeekU16LE - t.IDPeekU8: {two, false},
|
||||
t.IDPeekU24BE - t.IDPeekU8: {three, false},
|
||||
t.IDPeekU24LE - t.IDPeekU8: {three, false},
|
||||
t.IDPeekU32BE - t.IDPeekU8: {four, false},
|
||||
t.IDPeekU32LE - t.IDPeekU8: {four, false},
|
||||
t.IDPeekU40BE - t.IDPeekU8: {five, false},
|
||||
t.IDPeekU40LE - t.IDPeekU8: {five, false},
|
||||
t.IDPeekU48BE - t.IDPeekU8: {six, false},
|
||||
t.IDPeekU48LE - t.IDPeekU8: {six, false},
|
||||
t.IDPeekU56BE - t.IDPeekU8: {seven, false},
|
||||
t.IDPeekU56LE - t.IDPeekU8: {seven, false},
|
||||
t.IDPeekU64BE - t.IDPeekU8: {eight, false},
|
||||
t.IDPeekU64LE - t.IDPeekU8: {eight, false},
|
||||
|
||||
t.IDWriteFastU8 - t.IDPeekU8: {one, true},
|
||||
t.IDWriteFastU16BE - t.IDPeekU8: {two, true},
|
||||
t.IDWriteFastU16LE - t.IDPeekU8: {two, true},
|
||||
t.IDWriteFastU24BE - t.IDPeekU8: {three, true},
|
||||
t.IDWriteFastU24LE - t.IDPeekU8: {three, true},
|
||||
t.IDWriteFastU32BE - t.IDPeekU8: {four, true},
|
||||
t.IDWriteFastU32LE - t.IDPeekU8: {four, true},
|
||||
t.IDWriteFastU40BE - t.IDPeekU8: {five, true},
|
||||
t.IDWriteFastU40LE - t.IDPeekU8: {five, true},
|
||||
t.IDWriteFastU48BE - t.IDPeekU8: {six, true},
|
||||
t.IDWriteFastU48LE - t.IDPeekU8: {six, true},
|
||||
t.IDWriteFastU56BE - t.IDPeekU8: {seven, true},
|
||||
t.IDWriteFastU56LE - t.IDPeekU8: {seven, true},
|
||||
t.IDWriteFastU64BE - t.IDPeekU8: {eight, true},
|
||||
t.IDWriteFastU64LE - t.IDPeekU8: {eight, true},
|
||||
}
|
||||
|
||||
// makeSliceLength returns "x.length()".
|
||||
|
||||
@@ -494,6 +494,22 @@ const (
|
||||
IDWriteU64BE = ID(0x16E)
|
||||
IDWriteU64LE = ID(0x16F)
|
||||
|
||||
IDWriteFastU8 = ID(0x171)
|
||||
IDWriteFastU16BE = ID(0x172)
|
||||
IDWriteFastU16LE = ID(0x173)
|
||||
IDWriteFastU24BE = ID(0x174)
|
||||
IDWriteFastU24LE = ID(0x175)
|
||||
IDWriteFastU32BE = ID(0x176)
|
||||
IDWriteFastU32LE = ID(0x177)
|
||||
IDWriteFastU40BE = ID(0x178)
|
||||
IDWriteFastU40LE = ID(0x179)
|
||||
IDWriteFastU48BE = ID(0x17A)
|
||||
IDWriteFastU48LE = ID(0x17B)
|
||||
IDWriteFastU56BE = ID(0x17C)
|
||||
IDWriteFastU56LE = ID(0x17D)
|
||||
IDWriteFastU64BE = ID(0x17E)
|
||||
IDWriteFastU64LE = ID(0x17F)
|
||||
|
||||
IDSetLimit = ID(0x180)
|
||||
IDSetMark = ID(0x181)
|
||||
IDSinceMark = ID(0x182)
|
||||
@@ -755,6 +771,22 @@ var builtInsByID = [nBuiltInIDs]string{
|
||||
IDWriteU64BE: "write_u64be",
|
||||
IDWriteU64LE: "write_u64le",
|
||||
|
||||
IDWriteFastU8: "write_fast_u8",
|
||||
IDWriteFastU16BE: "write_fast_u16be",
|
||||
IDWriteFastU16LE: "write_fast_u16le",
|
||||
IDWriteFastU24BE: "write_fast_u24be",
|
||||
IDWriteFastU24LE: "write_fast_u24le",
|
||||
IDWriteFastU32BE: "write_fast_u32be",
|
||||
IDWriteFastU32LE: "write_fast_u32le",
|
||||
IDWriteFastU40BE: "write_fast_u40be",
|
||||
IDWriteFastU40LE: "write_fast_u40le",
|
||||
IDWriteFastU48BE: "write_fast_u48be",
|
||||
IDWriteFastU48LE: "write_fast_u48le",
|
||||
IDWriteFastU56BE: "write_fast_u56be",
|
||||
IDWriteFastU56LE: "write_fast_u56le",
|
||||
IDWriteFastU64BE: "write_fast_u64be",
|
||||
IDWriteFastU64LE: "write_fast_u64le",
|
||||
|
||||
IDSetLimit: "set_limit",
|
||||
IDSetMark: "set_mark",
|
||||
IDSinceMark: "since_mark",
|
||||
|
||||
Reference in new issue
Block a user