mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Add iterate advance parameter
This commit is contained in:
1 parent
f2c99e64ed
commit
a1a70da539
13 files changed
+209
-59
No files matched your search
@@ -35,6 +35,9 @@ const BaseFundamentalPrivateH = "" +
|
||||
"" +
|
||||
"// --------\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__ignore_status(wuffs_base__status z) {\n return wuffs_base__make_empty_struct();\n}\n\nstatic inline wuffs_base__status //\nwuffs_base__status__ensure_not_a_suspension(wuffs_base__status z) {\n if (z.repr && (*z.repr == '$')) {\n z.repr = wuffs_base__error__cannot_return_a_suspension;\n }\n return z;\n}\n\n" +
|
||||
"" +
|
||||
"// --------\n\n// wuffs_base__iterate_total_advance returns the exclusive pointer-offset at\n// which iteration should stop. The overall slice has length total_len, each\n// iteration's sub-slice has length iter_len and are placed iter_advance apart.\n//\n// The iter_advance may not be larger than iter_len. The iter_advance may be\n// smaller than iter_len, in which case the sub-slices will overlap.\n//\n// The return value r satisfies ((0 <= r) && (r <= total_len)).\n//\n// For example, if total_len = 15, iter_len = 5 and iter_advance = 3, there are\n// four iterations at offsets 0, 3, 6 and 9. This function returns 12.\n//\n// 0123456789012345\n// [....]\n// [....]\n// [....]\n// [....]\n// $\n// 0123456789012345\n//\n// For example, if total_len = 15, iter_len = 5 and iter_advance = 5, there are\n// three iterations at offsets 0, 5 and 10. This function returns 15.\n//\n// 0123456789012345\n// [....]\n// [....]\n// [....]\n// $\n// 0123456789012345\nstatic inline size_t //\nwuf" +
|
||||
"fs_base__iterate_total_advance(size_t total_len,\n size_t iter_len,\n size_t iter_advance) {\n if (total_len >= iter_len) {\n size_t n = total_len - iter_len;\n return ((n / iter_advance) * iter_advance) + iter_advance;\n }\n return 0;\n}\n\n" +
|
||||
"" +
|
||||
"// ---------------- Numeric Types\n\nextern const uint8_t wuffs_base__low_bits_mask__u8[9];\nextern const uint16_t wuffs_base__low_bits_mask__u16[17];\nextern const uint32_t wuffs_base__low_bits_mask__u32[33];\nextern const uint64_t wuffs_base__low_bits_mask__u64[65];\n\n#define WUFFS_BASE__LOW_BITS_MASK__U8(n) (wuffs_base__low_bits_mask__u8[n])\n#define WUFFS_BASE__LOW_BITS_MASK__U16(n) (wuffs_base__low_bits_mask__u16[n])\n#define WUFFS_BASE__LOW_BITS_MASK__U32(n) (wuffs_base__low_bits_mask__u32[n])\n#define WUFFS_BASE__LOW_BITS_MASK__U64(n) (wuffs_base__low_bits_mask__u64[n])\n\n" +
|
||||
"" +
|
||||
"// --------\n\nstatic inline void //\nwuffs_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 //\nwuffs_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 //\nwuffs_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 //\nwuffs_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 //\nwuffs_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 //\nwuffs_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 //\nwuffs_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 //\nwuffs_base__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {\n *x = wuffs_base__u64__sat_sub(*x, y);\n}\n\n" +
|
||||
|
||||
Reference in new issue
Block a user