mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
base: use wuffs_private_impl__etc names
This commit is contained in:
1 parent
883ad62c2f
commit
9a68ec70c6
15 files changed
+555
-479
No files matched your search
@@ -63,16 +63,16 @@ extern "C" {
|
||||
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__BASE) || \
|
||||
defined(WUFFS_CONFIG__MODULE__BASE__CORE)
|
||||
|
||||
const uint8_t wuffs_base__low_bits_mask__u8[8] = {
|
||||
const uint8_t wuffs_private_impl__low_bits_mask__u8[8] = {
|
||||
0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F,
|
||||
};
|
||||
|
||||
const uint16_t wuffs_base__low_bits_mask__u16[16] = {
|
||||
const uint16_t wuffs_private_impl__low_bits_mask__u16[16] = {
|
||||
0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F,
|
||||
0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF,
|
||||
};
|
||||
|
||||
const uint32_t wuffs_base__low_bits_mask__u32[32] = {
|
||||
const uint32_t wuffs_private_impl__low_bits_mask__u32[32] = {
|
||||
0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F,
|
||||
0x0000003F, 0x0000007F, 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF,
|
||||
0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF, 0x0001FFFF,
|
||||
@@ -81,7 +81,7 @@ const uint32_t wuffs_base__low_bits_mask__u32[32] = {
|
||||
0x3FFFFFFF, 0x7FFFFFFF,
|
||||
};
|
||||
|
||||
const uint64_t wuffs_base__low_bits_mask__u64[64] = {
|
||||
const uint64_t wuffs_private_impl__low_bits_mask__u64[64] = {
|
||||
0x0000000000000000, 0x0000000000000001, 0x0000000000000003,
|
||||
0x0000000000000007, 0x000000000000000F, 0x000000000000001F,
|
||||
0x000000000000003F, 0x000000000000007F, 0x00000000000000FF,
|
||||
@@ -106,25 +106,25 @@ const uint64_t wuffs_base__low_bits_mask__u64[64] = {
|
||||
0x7FFFFFFFFFFFFFFF,
|
||||
};
|
||||
|
||||
const uint32_t wuffs_base__pixel_format__bits_per_channel[16] = {
|
||||
const uint32_t wuffs_private_impl__pixel_format__bits_per_channel[16] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x0A, 0x0C, 0x10, 0x18, 0x20, 0x30, 0x40,
|
||||
};
|
||||
|
||||
const uint8_t //
|
||||
wuffs_base__placeholder_u8_with_non_null_address = 0;
|
||||
wuffs_private_impl__placeholder_u8_with_non_null_address = 0;
|
||||
|
||||
const uint16_t //
|
||||
wuffs_base__placeholder_u16_with_non_null_address = 0;
|
||||
wuffs_private_impl__placeholder_u16_with_non_null_address = 0;
|
||||
|
||||
const uint32_t //
|
||||
wuffs_base__placeholder_u32_with_non_null_address = 0;
|
||||
wuffs_private_impl__placeholder_u32_with_non_null_address = 0;
|
||||
|
||||
const uint64_t //
|
||||
wuffs_base__placeholder_u64_with_non_null_address = 0;
|
||||
wuffs_private_impl__placeholder_u64_with_non_null_address = 0;
|
||||
|
||||
const wuffs_base__token //
|
||||
wuffs_base__placeholder_token_with_non_null_address = {0};
|
||||
wuffs_private_impl__placeholder_token_with_non_null_address = {0};
|
||||
|
||||
// ¡ INSERT wuffs_base__status strings.
|
||||
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
// --------
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__ignore_status(wuffs_base__status z) {
|
||||
wuffs_private_impl__ignore_status(wuffs_base__status z) {
|
||||
return wuffs_base__make_empty_struct();
|
||||
}
|
||||
|
||||
static inline wuffs_base__status //
|
||||
wuffs_base__status__ensure_not_a_suspension(wuffs_base__status z) {
|
||||
wuffs_private_impl__status__ensure_not_a_suspension(wuffs_base__status z) {
|
||||
if (z.repr && (*z.repr == '$')) {
|
||||
z.repr = wuffs_base__error__cannot_return_a_suspension;
|
||||
}
|
||||
@@ -72,9 +72,10 @@ wuffs_base__status__ensure_not_a_suspension(wuffs_base__status z) {
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__iterate_total_advance returns the exclusive pointer-offset at
|
||||
// which iteration should stop. The overall slice has length total_len, each
|
||||
// iteration's sub-slice has length iter_len and are placed iter_advance apart.
|
||||
// wuffs_private_impl__iterate_total_advance returns the exclusive
|
||||
// pointer-offset at which iteration should stop. The overall slice has length
|
||||
// total_len, each iteration's sub-slice has length iter_len and are placed
|
||||
// iter_advance apart.
|
||||
//
|
||||
// The iter_advance may not be larger than iter_len. The iter_advance may be
|
||||
// smaller than iter_len, in which case the sub-slices will overlap.
|
||||
@@ -102,9 +103,9 @@ wuffs_base__status__ensure_not_a_suspension(wuffs_base__status z) {
|
||||
// $
|
||||
// 0123456789012345
|
||||
static inline size_t //
|
||||
wuffs_base__iterate_total_advance(size_t total_len,
|
||||
size_t iter_len,
|
||||
size_t iter_advance) {
|
||||
wuffs_private_impl__iterate_total_advance(size_t total_len,
|
||||
size_t iter_len,
|
||||
size_t iter_advance) {
|
||||
if (total_len >= iter_len) {
|
||||
size_t n = total_len - iter_len;
|
||||
return ((n / iter_advance) * iter_advance) + iter_advance;
|
||||
@@ -114,55 +115,59 @@ wuffs_base__iterate_total_advance(size_t total_len,
|
||||
|
||||
// ---------------- Numeric Types
|
||||
|
||||
extern const uint8_t wuffs_base__low_bits_mask__u8[8];
|
||||
extern const uint16_t wuffs_base__low_bits_mask__u16[16];
|
||||
extern const uint32_t wuffs_base__low_bits_mask__u32[32];
|
||||
extern const uint64_t wuffs_base__low_bits_mask__u64[64];
|
||||
extern const uint8_t wuffs_private_impl__low_bits_mask__u8[8];
|
||||
extern const uint16_t wuffs_private_impl__low_bits_mask__u16[16];
|
||||
extern const uint32_t wuffs_private_impl__low_bits_mask__u32[32];
|
||||
extern const uint64_t wuffs_private_impl__low_bits_mask__u64[64];
|
||||
|
||||
#define WUFFS_BASE__LOW_BITS_MASK__U8(n) (wuffs_base__low_bits_mask__u8[n])
|
||||
#define WUFFS_BASE__LOW_BITS_MASK__U16(n) (wuffs_base__low_bits_mask__u16[n])
|
||||
#define WUFFS_BASE__LOW_BITS_MASK__U32(n) (wuffs_base__low_bits_mask__u32[n])
|
||||
#define WUFFS_BASE__LOW_BITS_MASK__U64(n) (wuffs_base__low_bits_mask__u64[n])
|
||||
#define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U8(n) \
|
||||
(wuffs_private_impl__low_bits_mask__u8[n])
|
||||
#define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U16(n) \
|
||||
(wuffs_private_impl__low_bits_mask__u16[n])
|
||||
#define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U32(n) \
|
||||
(wuffs_private_impl__low_bits_mask__u32[n])
|
||||
#define WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U64(n) \
|
||||
(wuffs_private_impl__low_bits_mask__u64[n])
|
||||
|
||||
// --------
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
wuffs_private_impl__u8__sat_add_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_add(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u8__sat_sub_indirect(uint8_t* x, uint8_t y) {
|
||||
wuffs_private_impl__u8__sat_sub_indirect(uint8_t* x, uint8_t y) {
|
||||
*x = wuffs_base__u8__sat_sub(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u16__sat_add_indirect(uint16_t* x, uint16_t y) {
|
||||
wuffs_private_impl__u16__sat_add_indirect(uint16_t* x, uint16_t y) {
|
||||
*x = wuffs_base__u16__sat_add(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u16__sat_sub_indirect(uint16_t* x, uint16_t y) {
|
||||
wuffs_private_impl__u16__sat_sub_indirect(uint16_t* x, uint16_t y) {
|
||||
*x = wuffs_base__u16__sat_sub(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u32__sat_add_indirect(uint32_t* x, uint32_t y) {
|
||||
wuffs_private_impl__u32__sat_add_indirect(uint32_t* x, uint32_t y) {
|
||||
*x = wuffs_base__u32__sat_add(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u32__sat_sub_indirect(uint32_t* x, uint32_t y) {
|
||||
wuffs_private_impl__u32__sat_sub_indirect(uint32_t* x, uint32_t y) {
|
||||
*x = wuffs_base__u32__sat_sub(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u64__sat_add_indirect(uint64_t* x, uint64_t y) {
|
||||
wuffs_private_impl__u64__sat_add_indirect(uint64_t* x, uint64_t y) {
|
||||
*x = wuffs_base__u64__sat_add(*x, y);
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {
|
||||
wuffs_private_impl__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {
|
||||
*x = wuffs_base__u64__sat_sub(*x, y);
|
||||
}
|
||||
|
||||
@@ -182,18 +187,20 @@ wuffs_base__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {
|
||||
|
||||
// ---------------- Slices and Tables
|
||||
|
||||
// wuffs_base__slice_u8__prefix returns up to the first up_to bytes of s.
|
||||
// wuffs_private_impl__slice_u8__prefix returns up to the first up_to bytes of
|
||||
// s.
|
||||
static inline wuffs_base__slice_u8 //
|
||||
wuffs_base__slice_u8__prefix(wuffs_base__slice_u8 s, uint64_t up_to) {
|
||||
wuffs_private_impl__slice_u8__prefix(wuffs_base__slice_u8 s, uint64_t up_to) {
|
||||
if (((uint64_t)(s.len)) > up_to) {
|
||||
s.len = ((size_t)up_to);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// wuffs_base__slice_u8__suffix returns up to the last up_to bytes of s.
|
||||
// wuffs_private_impl__slice_u8__suffix returns up to the last up_to bytes of
|
||||
// s.
|
||||
static inline wuffs_base__slice_u8 //
|
||||
wuffs_base__slice_u8__suffix(wuffs_base__slice_u8 s, uint64_t up_to) {
|
||||
wuffs_private_impl__slice_u8__suffix(wuffs_base__slice_u8 s, uint64_t up_to) {
|
||||
if (((uint64_t)(s.len)) > up_to) {
|
||||
s.ptr += ((uint64_t)(s.len)) - up_to;
|
||||
s.len = ((size_t)up_to);
|
||||
@@ -201,13 +208,13 @@ wuffs_base__slice_u8__suffix(wuffs_base__slice_u8 s, uint64_t up_to) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// wuffs_base__slice_u8__copy_from_slice calls memmove(dst.ptr, src.ptr, len)
|
||||
// where len is the minimum of dst.len and src.len.
|
||||
// wuffs_private_impl__slice_u8__copy_from_slice calls memmove(dst.ptr,
|
||||
// src.ptr, len) where len is the minimum of dst.len and src.len.
|
||||
//
|
||||
// Passing a wuffs_base__slice_u8 with all fields NULL or zero (a valid, empty
|
||||
// slice) is valid and results in a no-op.
|
||||
static inline uint64_t //
|
||||
wuffs_base__slice_u8__copy_from_slice(wuffs_base__slice_u8 dst,
|
||||
wuffs_private_impl__slice_u8__copy_from_slice(wuffs_base__slice_u8 dst,
|
||||
wuffs_base__slice_u8 src) {
|
||||
size_t len = dst.len < src.len ? dst.len : src.len;
|
||||
if (len > 0) {
|
||||
@@ -217,9 +224,9 @@ wuffs_base__slice_u8__copy_from_slice(wuffs_base__slice_u8 dst,
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__bulk_load_host_endian(void* ptr,
|
||||
size_t len,
|
||||
wuffs_base__slice_u8 src) {
|
||||
wuffs_private_impl__bulk_load_host_endian(void* ptr,
|
||||
size_t len,
|
||||
wuffs_base__slice_u8 src) {
|
||||
if (len && (len <= src.len)) {
|
||||
memmove(ptr, src.ptr, len);
|
||||
}
|
||||
@@ -227,7 +234,7 @@ wuffs_base__bulk_load_host_endian(void* ptr,
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__bulk_memset(void* ptr, size_t len, uint8_t byte_value) {
|
||||
wuffs_private_impl__bulk_memset(void* ptr, size_t len, uint8_t byte_value) {
|
||||
if (len) {
|
||||
memset(ptr, byte_value, len);
|
||||
}
|
||||
@@ -235,9 +242,9 @@ wuffs_base__bulk_memset(void* ptr, size_t len, uint8_t byte_value) {
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__bulk_save_host_endian(void* ptr,
|
||||
size_t len,
|
||||
wuffs_base__slice_u8 dst) {
|
||||
wuffs_private_impl__bulk_save_host_endian(void* ptr,
|
||||
size_t len,
|
||||
wuffs_base__slice_u8 dst) {
|
||||
if (len && (len <= dst.len)) {
|
||||
memmove(dst.ptr, ptr, len);
|
||||
}
|
||||
@@ -247,7 +254,7 @@ wuffs_base__bulk_save_host_endian(void* ptr,
|
||||
// --------
|
||||
|
||||
static inline wuffs_base__slice_u8 //
|
||||
wuffs_base__table_u8__row_u32(wuffs_base__table_u8 t, uint32_t y) {
|
||||
wuffs_private_impl__table_u8__row_u32(wuffs_base__table_u8 t, uint32_t y) {
|
||||
if (y < t.height) {
|
||||
return wuffs_base__make_slice_u8(t.ptr + (t.stride * y), t.width);
|
||||
}
|
||||
|
||||
@@ -389,25 +389,25 @@ wuffs_base__strip_const_from_u64_ptr(const uint64_t* ptr) {
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__placeholder_etc_with_non_null_address provides non-NULL pointers
|
||||
// to various integer types. These values aren't intended to ever be modified
|
||||
// and their addresses aren't intended to ever be dereferenced.
|
||||
// wuffs_private_impl__placeholder_etc_with_non_null_address provides non-NULL
|
||||
// pointers to various integer types. These values aren't intended to ever be
|
||||
// modified and their addresses aren't intended to ever be dereferenced.
|
||||
//
|
||||
// It's just that adding 0 to a NULL pointer can be undefined behavior (and
|
||||
// UBSAN will complain), so functions like wuffs_base__empty_slice_u8 need some
|
||||
// arbitrary non-NULL placeholder pointer, even though the slice has 0 length.
|
||||
|
||||
extern const uint8_t //
|
||||
wuffs_base__placeholder_u8_with_non_null_address;
|
||||
wuffs_private_impl__placeholder_u8_with_non_null_address;
|
||||
|
||||
extern const uint16_t //
|
||||
wuffs_base__placeholder_u16_with_non_null_address;
|
||||
wuffs_private_impl__placeholder_u16_with_non_null_address;
|
||||
|
||||
extern const uint32_t //
|
||||
wuffs_base__placeholder_u32_with_non_null_address;
|
||||
wuffs_private_impl__placeholder_u32_with_non_null_address;
|
||||
|
||||
extern const uint64_t //
|
||||
wuffs_base__placeholder_u64_with_non_null_address;
|
||||
wuffs_private_impl__placeholder_u64_with_non_null_address;
|
||||
|
||||
// --------
|
||||
|
||||
@@ -1364,7 +1364,7 @@ static inline wuffs_base__slice_u8 //
|
||||
wuffs_base__empty_slice_u8(void) {
|
||||
wuffs_base__slice_u8 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u8_ptr(
|
||||
&wuffs_base__placeholder_u8_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u8_with_non_null_address);
|
||||
ret.len = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -1373,7 +1373,7 @@ static inline wuffs_base__slice_u16 //
|
||||
wuffs_base__empty_slice_u16(void) {
|
||||
wuffs_base__slice_u16 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u16_ptr(
|
||||
&wuffs_base__placeholder_u16_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u16_with_non_null_address);
|
||||
ret.len = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -1382,7 +1382,7 @@ static inline wuffs_base__slice_u32 //
|
||||
wuffs_base__empty_slice_u32(void) {
|
||||
wuffs_base__slice_u32 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u32_ptr(
|
||||
&wuffs_base__placeholder_u32_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u32_with_non_null_address);
|
||||
ret.len = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -1391,7 +1391,7 @@ static inline wuffs_base__slice_u64 //
|
||||
wuffs_base__empty_slice_u64(void) {
|
||||
wuffs_base__slice_u64 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u64_ptr(
|
||||
&wuffs_base__placeholder_u64_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u64_with_non_null_address);
|
||||
ret.len = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -1452,7 +1452,7 @@ static inline wuffs_base__table_u8 //
|
||||
wuffs_base__empty_table_u8(void) {
|
||||
wuffs_base__table_u8 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u8_ptr(
|
||||
&wuffs_base__placeholder_u8_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u8_with_non_null_address);
|
||||
ret.width = 0;
|
||||
ret.height = 0;
|
||||
ret.stride = 0;
|
||||
@@ -1463,7 +1463,7 @@ static inline wuffs_base__table_u16 //
|
||||
wuffs_base__empty_table_u16(void) {
|
||||
wuffs_base__table_u16 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u16_ptr(
|
||||
&wuffs_base__placeholder_u16_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u16_with_non_null_address);
|
||||
ret.width = 0;
|
||||
ret.height = 0;
|
||||
ret.stride = 0;
|
||||
@@ -1474,7 +1474,7 @@ static inline wuffs_base__table_u32 //
|
||||
wuffs_base__empty_table_u32(void) {
|
||||
wuffs_base__table_u32 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u32_ptr(
|
||||
&wuffs_base__placeholder_u32_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u32_with_non_null_address);
|
||||
ret.width = 0;
|
||||
ret.height = 0;
|
||||
ret.stride = 0;
|
||||
@@ -1485,7 +1485,7 @@ static inline wuffs_base__table_u64 //
|
||||
wuffs_base__empty_table_u64(void) {
|
||||
wuffs_base__table_u64 ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_u64_ptr(
|
||||
&wuffs_base__placeholder_u64_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u64_with_non_null_address);
|
||||
ret.width = 0;
|
||||
ret.height = 0;
|
||||
ret.stride = 0;
|
||||
|
||||
@@ -387,7 +387,7 @@ wuffs_base__make_pixel_format(uint32_t repr) {
|
||||
#define WUFFS_BASE__PIXEL_FORMAT__CMY 0xC0020888
|
||||
#define WUFFS_BASE__PIXEL_FORMAT__CMYK 0xD0038888
|
||||
|
||||
extern const uint32_t wuffs_base__pixel_format__bits_per_channel[16];
|
||||
extern const uint32_t wuffs_private_impl__pixel_format__bits_per_channel[16];
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__pixel_format__is_valid(const wuffs_base__pixel_format* f) {
|
||||
@@ -401,10 +401,14 @@ wuffs_base__pixel_format__bits_per_pixel(const wuffs_base__pixel_format* f) {
|
||||
if (((f->repr >> 16) & 0x03) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return wuffs_base__pixel_format__bits_per_channel[0x0F & (f->repr >> 0)] +
|
||||
wuffs_base__pixel_format__bits_per_channel[0x0F & (f->repr >> 4)] +
|
||||
wuffs_base__pixel_format__bits_per_channel[0x0F & (f->repr >> 8)] +
|
||||
wuffs_base__pixel_format__bits_per_channel[0x0F & (f->repr >> 12)];
|
||||
return wuffs_private_impl__pixel_format__bits_per_channel[0x0F &
|
||||
(f->repr >> 0)] +
|
||||
wuffs_private_impl__pixel_format__bits_per_channel[0x0F &
|
||||
(f->repr >> 4)] +
|
||||
wuffs_private_impl__pixel_format__bits_per_channel[0x0F &
|
||||
(f->repr >> 8)] +
|
||||
wuffs_private_impl__pixel_format__bits_per_channel[0x0F &
|
||||
(f->repr >> 12)];
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// ---------------- I/O
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__io__count_since(uint64_t mark, uint64_t index) {
|
||||
wuffs_private_impl__io__count_since(uint64_t mark, uint64_t index) {
|
||||
if (index >= mark) {
|
||||
return index - mark;
|
||||
}
|
||||
@@ -25,7 +25,9 @@ wuffs_base__io__count_since(uint64_t mark, uint64_t index) {
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
#endif
|
||||
static inline wuffs_base__slice_u8 //
|
||||
wuffs_base__io__since(uint64_t mark, uint64_t index, const uint8_t* ptr) {
|
||||
wuffs_private_impl__io__since(uint64_t mark,
|
||||
uint64_t index,
|
||||
const uint8_t* ptr) {
|
||||
if (index >= mark) {
|
||||
return wuffs_base__make_slice_u8(((uint8_t*)ptr) + mark,
|
||||
((size_t)(index - mark)));
|
||||
@@ -39,19 +41,20 @@ wuffs_base__io__since(uint64_t mark, uint64_t index, const uint8_t* ptr) {
|
||||
// --------
|
||||
|
||||
static inline void //
|
||||
wuffs_base__io_reader__limit(const uint8_t** ptr_io2_r,
|
||||
const uint8_t* iop_r,
|
||||
uint64_t limit) {
|
||||
wuffs_private_impl__io_reader__limit(const uint8_t** ptr_io2_r,
|
||||
const uint8_t* iop_r,
|
||||
uint64_t limit) {
|
||||
if (((uint64_t)(*ptr_io2_r - iop_r)) > limit) {
|
||||
*ptr_io2_r = iop_r + limit;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_reader__limited_copy_u32_to_slice(const uint8_t** ptr_iop_r,
|
||||
const uint8_t* io2_r,
|
||||
uint32_t length,
|
||||
wuffs_base__slice_u8 dst) {
|
||||
wuffs_private_impl__io_reader__limited_copy_u32_to_slice(
|
||||
const uint8_t** ptr_iop_r,
|
||||
const uint8_t* io2_r,
|
||||
uint32_t length,
|
||||
wuffs_base__slice_u8 dst) {
|
||||
const uint8_t* iop_r = *ptr_iop_r;
|
||||
size_t n = dst.len;
|
||||
if (n > length) {
|
||||
@@ -67,9 +70,9 @@ wuffs_base__io_reader__limited_copy_u32_to_slice(const uint8_t** ptr_iop_r,
|
||||
return (uint32_t)(n);
|
||||
}
|
||||
|
||||
// wuffs_base__io_reader__match7 returns whether the io_reader's upcoming bytes
|
||||
// start with the given prefix (up to 7 bytes long). It is peek-like, not
|
||||
// read-like, in that there are no side-effects.
|
||||
// wuffs_private_impl__io_reader__match7 returns whether the io_reader's
|
||||
// upcoming bytes start with the given prefix (up to 7 bytes long). It is
|
||||
// peek-like, not read-like, in that there are no side-effects.
|
||||
//
|
||||
// The low 3 bits of a hold the prefix length, n.
|
||||
//
|
||||
@@ -82,10 +85,10 @@ wuffs_base__io_reader__limited_copy_u32_to_slice(const uint8_t** ptr_iop_r,
|
||||
// - 1 means inconclusive, equivalent to "$short read".
|
||||
// - 2 means failure.
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_reader__match7(const uint8_t* iop_r,
|
||||
const uint8_t* io2_r,
|
||||
wuffs_base__io_buffer* r,
|
||||
uint64_t a) {
|
||||
wuffs_private_impl__io_reader__match7(const uint8_t* iop_r,
|
||||
const uint8_t* io2_r,
|
||||
wuffs_base__io_buffer* r,
|
||||
uint64_t a) {
|
||||
uint32_t n = a & 7;
|
||||
a >>= 8;
|
||||
if ((io2_r - iop_r) >= 8) {
|
||||
@@ -106,13 +109,13 @@ wuffs_base__io_reader__match7(const uint8_t* iop_r,
|
||||
}
|
||||
|
||||
static inline wuffs_base__io_buffer* //
|
||||
wuffs_base__io_reader__set(wuffs_base__io_buffer* b,
|
||||
const uint8_t** ptr_iop_r,
|
||||
const uint8_t** ptr_io0_r,
|
||||
const uint8_t** ptr_io1_r,
|
||||
const uint8_t** ptr_io2_r,
|
||||
wuffs_base__slice_u8 data,
|
||||
uint64_t history_position) {
|
||||
wuffs_private_impl__io_reader__set(wuffs_base__io_buffer* b,
|
||||
const uint8_t** ptr_iop_r,
|
||||
const uint8_t** ptr_io0_r,
|
||||
const uint8_t** ptr_io1_r,
|
||||
const uint8_t** ptr_io2_r,
|
||||
wuffs_base__slice_u8 data,
|
||||
uint64_t history_position) {
|
||||
b->data = data;
|
||||
b->meta.wi = data.len;
|
||||
b->meta.ri = 0;
|
||||
@@ -130,9 +133,9 @@ wuffs_base__io_reader__set(wuffs_base__io_buffer* b,
|
||||
// --------
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__io_writer__copy_from_slice(uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
wuffs_base__slice_u8 src) {
|
||||
wuffs_private_impl__io_writer__copy_from_slice(uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
wuffs_base__slice_u8 src) {
|
||||
uint8_t* iop_w = *ptr_iop_w;
|
||||
size_t n = src.len;
|
||||
if (n > ((size_t)(io2_w - iop_w))) {
|
||||
@@ -146,20 +149,21 @@ wuffs_base__io_writer__copy_from_slice(uint8_t** ptr_iop_w,
|
||||
}
|
||||
|
||||
static inline void //
|
||||
wuffs_base__io_writer__limit(uint8_t** ptr_io2_w,
|
||||
uint8_t* iop_w,
|
||||
uint64_t limit) {
|
||||
wuffs_private_impl__io_writer__limit(uint8_t** ptr_io2_w,
|
||||
uint8_t* iop_w,
|
||||
uint64_t limit) {
|
||||
if (((uint64_t)(*ptr_io2_w - iop_w)) > limit) {
|
||||
*ptr_io2_w = iop_w + limit;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_history(uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
uint32_t distance) {
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_history(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
uint32_t distance) {
|
||||
if (!distance) {
|
||||
return 0;
|
||||
}
|
||||
@@ -181,7 +185,8 @@ wuffs_base__io_writer__limited_copy_u32_from_history(uint8_t** ptr_iop_w,
|
||||
// argument, and the cgen can look if that argument is the constant
|
||||
// expression '3'.
|
||||
//
|
||||
// See also wuffs_base__io_writer__limited_copy_u32_from_history_fast below.
|
||||
// See also wuffs_private_impl__io_writer__limited_copy_u32_from_history_fast
|
||||
// below.
|
||||
for (; n >= 3; n -= 3) {
|
||||
*p++ = *q++;
|
||||
*p++ = *q++;
|
||||
@@ -194,20 +199,21 @@ wuffs_base__io_writer__limited_copy_u32_from_history(uint8_t** ptr_iop_w,
|
||||
return length;
|
||||
}
|
||||
|
||||
// wuffs_base__io_writer__limited_copy_u32_from_history_fast is like the
|
||||
// wuffs_base__io_writer__limited_copy_u32_from_history function above, but has
|
||||
// stronger pre-conditions.
|
||||
// wuffs_private_impl__io_writer__limited_copy_u32_from_history_fast is like
|
||||
// the wuffs_private_impl__io_writer__limited_copy_u32_from_history function
|
||||
// above, but has stronger pre-conditions.
|
||||
//
|
||||
// The caller needs to prove that:
|
||||
// - length <= (io2_w - *ptr_iop_w)
|
||||
// - distance >= 1
|
||||
// - distance <= (*ptr_iop_w - io0_w)
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_history_fast(uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
uint32_t distance) {
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_history_fast(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
uint32_t distance) {
|
||||
uint8_t* p = *ptr_iop_w;
|
||||
uint8_t* q = p - distance;
|
||||
uint32_t n = length;
|
||||
@@ -223,7 +229,7 @@ wuffs_base__io_writer__limited_copy_u32_from_history_fast(uint8_t** ptr_iop_w,
|
||||
return length;
|
||||
}
|
||||
|
||||
// wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fast
|
||||
// wuffs_private_impl__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fast
|
||||
// copies the previous byte (the one immediately before *ptr_iop_w), copying 8
|
||||
// byte chunks at a time. Each chunk contains 8 repetitions of the same byte.
|
||||
//
|
||||
@@ -238,7 +244,7 @@ wuffs_base__io_writer__limited_copy_u32_from_history_fast(uint8_t** ptr_iop_w,
|
||||
// - distance == 1
|
||||
// - distance <= (*ptr_iop_w - io0_w)
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fast(
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fast(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
@@ -263,8 +269,9 @@ wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fa
|
||||
return length;
|
||||
}
|
||||
|
||||
// wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_fast is
|
||||
// like the wuffs_base__io_writer__limited_copy_u32_from_history_fast function
|
||||
// wuffs_private_impl__io_writer__limited_copy_u32_from_history_8_byte_chunks_fast
|
||||
// is like the
|
||||
// wuffs_private_impl__io_writer__limited_copy_u32_from_history_fast function
|
||||
// above, but copies 8 byte chunks at a time.
|
||||
//
|
||||
// In terms of number of bytes copied, length is rounded up to a multiple of 8.
|
||||
@@ -278,7 +285,7 @@ wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_distance_1_fa
|
||||
// - distance >= 8
|
||||
// - distance <= (*ptr_iop_w - io0_w)
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_fast(
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_history_8_byte_chunks_fast(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io0_w,
|
||||
uint8_t* io2_w,
|
||||
@@ -302,11 +309,12 @@ wuffs_base__io_writer__limited_copy_u32_from_history_8_byte_chunks_fast(
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_reader(uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
const uint8_t** ptr_iop_r,
|
||||
const uint8_t* io2_r) {
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_reader(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
const uint8_t** ptr_iop_r,
|
||||
const uint8_t* io2_r) {
|
||||
uint8_t* iop_w = *ptr_iop_w;
|
||||
size_t n = length;
|
||||
if (n > ((size_t)(io2_w - iop_w))) {
|
||||
@@ -325,10 +333,11 @@ wuffs_base__io_writer__limited_copy_u32_from_reader(uint8_t** ptr_iop_w,
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__io_writer__limited_copy_u32_from_slice(uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
wuffs_base__slice_u8 src) {
|
||||
wuffs_private_impl__io_writer__limited_copy_u32_from_slice(
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t* io2_w,
|
||||
uint32_t length,
|
||||
wuffs_base__slice_u8 src) {
|
||||
uint8_t* iop_w = *ptr_iop_w;
|
||||
size_t n = src.len;
|
||||
if (n > length) {
|
||||
@@ -345,13 +354,13 @@ wuffs_base__io_writer__limited_copy_u32_from_slice(uint8_t** ptr_iop_w,
|
||||
}
|
||||
|
||||
static inline wuffs_base__io_buffer* //
|
||||
wuffs_base__io_writer__set(wuffs_base__io_buffer* b,
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t** ptr_io0_w,
|
||||
uint8_t** ptr_io1_w,
|
||||
uint8_t** ptr_io2_w,
|
||||
wuffs_base__slice_u8 data,
|
||||
uint64_t history_position) {
|
||||
wuffs_private_impl__io_writer__set(wuffs_base__io_buffer* b,
|
||||
uint8_t** ptr_iop_w,
|
||||
uint8_t** ptr_io0_w,
|
||||
uint8_t** ptr_io1_w,
|
||||
uint8_t** ptr_io2_w,
|
||||
wuffs_base__slice_u8 data,
|
||||
uint64_t history_position) {
|
||||
b->data = data;
|
||||
b->meta.wi = 0;
|
||||
b->meta.ri = 0;
|
||||
|
||||
@@ -119,7 +119,7 @@ static inline wuffs_base__io_buffer //
|
||||
wuffs_base__empty_io_buffer(void) {
|
||||
wuffs_base__io_buffer ret;
|
||||
ret.data.ptr = wuffs_base__strip_const_from_u8_ptr(
|
||||
&wuffs_base__placeholder_u8_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_u8_with_non_null_address);
|
||||
ret.data.len = 0;
|
||||
ret.meta.wi = 0;
|
||||
ret.meta.ri = 0;
|
||||
|
||||
@@ -4459,7 +4459,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
wuffs_base__pixel_blend blend) {
|
||||
switch (dst_pixfmt.repr) {
|
||||
case WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_NONPREMUL:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4480,7 +4481,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
}
|
||||
return wuffs_private_impl__swizzle_bgr_565__index__src;
|
||||
case WUFFS_BASE__PIXEL_BLEND__SRC_OVER:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4499,7 +4501,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
}
|
||||
return wuffs_private_impl__swizzle_xxx__index__src;
|
||||
case WUFFS_BASE__PIXEL_BLEND__SRC_OVER:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4508,7 +4511,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
return NULL;
|
||||
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4521,7 +4525,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
return NULL;
|
||||
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4544,7 +4549,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_nonpremul(
|
||||
}
|
||||
return wuffs_private_impl__swizzle_xxxx__index__src;
|
||||
case WUFFS_BASE__PIXEL_BLEND__SRC_OVER:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4627,7 +4633,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_binary(
|
||||
case WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_NONPREMUL:
|
||||
case WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_PREMUL:
|
||||
case WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4653,7 +4660,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_binary(
|
||||
return NULL;
|
||||
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGR:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4668,7 +4676,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_binary(
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL:
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL:
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_BINARY:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -4682,7 +4691,8 @@ wuffs_private_impl__pixel_swizzler__prepare__indexed__bgra_binary(
|
||||
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE:
|
||||
case WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL_4X16LE:
|
||||
if (wuffs_base__slice_u8__copy_from_slice(dst_palette, src_palette) !=
|
||||
if (wuffs_private_impl__slice_u8__copy_from_slice(dst_palette,
|
||||
src_palette) !=
|
||||
WUFFS_BASE__PIXEL_FORMAT__INDEXED__PALETTE_BYTE_LENGTH) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -11,42 +11,50 @@
|
||||
// ---------------- Ranges and Rects
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__range_ii_u32__get_min_incl(const wuffs_base__range_ii_u32* r) {
|
||||
wuffs_private_impl__range_ii_u32__get_min_incl(
|
||||
const wuffs_base__range_ii_u32* r) {
|
||||
return r->min_incl;
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__range_ii_u32__get_max_incl(const wuffs_base__range_ii_u32* r) {
|
||||
wuffs_private_impl__range_ii_u32__get_max_incl(
|
||||
const wuffs_base__range_ii_u32* r) {
|
||||
return r->max_incl;
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__range_ie_u32__get_min_incl(const wuffs_base__range_ie_u32* r) {
|
||||
wuffs_private_impl__range_ie_u32__get_min_incl(
|
||||
const wuffs_base__range_ie_u32* r) {
|
||||
return r->min_incl;
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__range_ie_u32__get_max_excl(const wuffs_base__range_ie_u32* r) {
|
||||
wuffs_private_impl__range_ie_u32__get_max_excl(
|
||||
const wuffs_base__range_ie_u32* r) {
|
||||
return r->max_excl;
|
||||
}
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__range_ii_u64__get_min_incl(const wuffs_base__range_ii_u64* r) {
|
||||
wuffs_private_impl__range_ii_u64__get_min_incl(
|
||||
const wuffs_base__range_ii_u64* r) {
|
||||
return r->min_incl;
|
||||
}
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__range_ii_u64__get_max_incl(const wuffs_base__range_ii_u64* r) {
|
||||
wuffs_private_impl__range_ii_u64__get_max_incl(
|
||||
const wuffs_base__range_ii_u64* r) {
|
||||
return r->max_incl;
|
||||
}
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__range_ie_u64__get_min_incl(const wuffs_base__range_ie_u64* r) {
|
||||
wuffs_private_impl__range_ie_u64__get_min_incl(
|
||||
const wuffs_base__range_ie_u64* r) {
|
||||
return r->min_incl;
|
||||
}
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__range_ie_u64__get_max_excl(const wuffs_base__range_ie_u64* r) {
|
||||
wuffs_private_impl__range_ie_u64__get_max_excl(
|
||||
const wuffs_base__range_ie_u64* r) {
|
||||
return r->max_excl;
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ wuffs_base__token::length() const {
|
||||
// --------
|
||||
|
||||
extern const wuffs_base__token //
|
||||
wuffs_base__placeholder_token_with_non_null_address;
|
||||
wuffs_private_impl__placeholder_token_with_non_null_address;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
@@ -310,7 +310,7 @@ static inline wuffs_base__slice_token //
|
||||
wuffs_base__empty_slice_token(void) {
|
||||
wuffs_base__slice_token ret;
|
||||
ret.ptr = wuffs_base__strip_const_from_token_ptr(
|
||||
&wuffs_base__placeholder_token_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_token_with_non_null_address);
|
||||
ret.len = 0;
|
||||
return ret;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ static inline wuffs_base__token_buffer //
|
||||
wuffs_base__empty_token_buffer(void) {
|
||||
wuffs_base__token_buffer ret;
|
||||
ret.data.ptr = wuffs_base__strip_const_from_token_ptr(
|
||||
&wuffs_base__placeholder_token_with_non_null_address);
|
||||
&wuffs_private_impl__placeholder_token_with_non_null_address);
|
||||
ret.data.len = 0;
|
||||
ret.meta.wi = 0;
|
||||
ret.meta.ri = 0;
|
||||
|
||||
+18
-18
@@ -208,12 +208,12 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDLimitedCopyU32ToSlice:
|
||||
b.printf("wuffs_base__io_reader__limited_copy_u32_to_slice(\n&%s%s, %s%s,",
|
||||
b.printf("wuffs_private_impl__io_reader__limited_copy_u32_to_slice(\n&%s%s, %s%s,",
|
||||
iopPrefix, recvName, io2Prefix, recvName)
|
||||
return g.writeArgs(b, args, depth)
|
||||
|
||||
case t.IDCountSince:
|
||||
b.printf("wuffs_base__io__count_since(")
|
||||
b.printf("wuffs_private_impl__io__count_since(")
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -229,7 +229,7 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDMatch7:
|
||||
b.printf("wuffs_base__io_reader__match7(%s%s, %s%s, %s, ",
|
||||
b.printf("wuffs_private_impl__io_reader__match7(%s%s, %s%s, %s, ",
|
||||
iopPrefix, recvName, io2Prefix, recvName, recvName)
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
@@ -251,7 +251,7 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDSince:
|
||||
b.printf("wuffs_base__io__since(")
|
||||
b.printf("wuffs_private_impl__io__since(")
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
t.IDLimitedCopyU32FromHistory8ByteChunksDistance1Fast,
|
||||
t.IDLimitedCopyU32FromHistory8ByteChunksFast,
|
||||
t.IDLimitedCopyU32FromHistoryFast:
|
||||
b.printf("wuffs_base__io_writer__%s(\n&%s%s, %s%s, %s%s",
|
||||
b.printf("wuffs_private_impl__io_writer__%s(\n&%s%s, %s%s, %s%s",
|
||||
method.Str(g.tm), iopPrefix, recvName, io0Prefix, recvName, io2Prefix, recvName)
|
||||
for _, o := range args {
|
||||
b.writes(", ")
|
||||
@@ -324,7 +324,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return err
|
||||
}
|
||||
|
||||
b.printf("wuffs_base__io_writer__limited_copy_u32_from_reader(\n&%s%s, %s%s,",
|
||||
b.printf("wuffs_private_impl__io_writer__limited_copy_u32_from_reader(\n&%s%s, %s%s,",
|
||||
iopPrefix, recvName, io2Prefix, recvName)
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
@@ -333,17 +333,17 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDCopyFromSlice:
|
||||
b.printf("wuffs_base__io_writer__copy_from_slice(&%s%s, %s%s,",
|
||||
b.printf("wuffs_private_impl__io_writer__copy_from_slice(&%s%s, %s%s,",
|
||||
iopPrefix, recvName, io2Prefix, recvName)
|
||||
return g.writeArgs(b, args, depth)
|
||||
|
||||
case t.IDLimitedCopyU32FromSlice:
|
||||
b.printf("wuffs_base__io_writer__limited_copy_u32_from_slice(\n&%s%s, %s%s,",
|
||||
b.printf("wuffs_private_impl__io_writer__limited_copy_u32_from_slice(\n&%s%s, %s%s,",
|
||||
iopPrefix, recvName, io2Prefix, recvName)
|
||||
return g.writeArgs(b, args, depth)
|
||||
|
||||
case t.IDCountSince:
|
||||
b.printf("wuffs_base__io__count_since(")
|
||||
b.printf("wuffs_private_impl__io__count_since(")
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -364,7 +364,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDSince:
|
||||
b.printf("wuffs_base__io__since(")
|
||||
b.printf("wuffs_private_impl__io__since(")
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -804,7 +804,7 @@ func (g *gen) writeBuiltinNumType(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
case t.IDLowBits:
|
||||
// "recv.low_bits(n:etc)" in C is one of:
|
||||
// - "((recv) & constant)"
|
||||
// - "((recv) & WUFFS_BASE__LOW_BITS_MASK__UXX(n))"
|
||||
// - "((recv) & WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__UXX(n))"
|
||||
b.writes("((")
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
@@ -820,7 +820,7 @@ func (g *gen) writeBuiltinNumType(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
if sz, err := g.sizeof(recv.MType()); err != nil {
|
||||
return err
|
||||
} else {
|
||||
b.printf("WUFFS_BASE__LOW_BITS_MASK__U%d(", 8*sz)
|
||||
b.printf("WUFFS_PRIVATE_IMPL__LOW_BITS_MASK__U%d(", 8*sz)
|
||||
}
|
||||
if err := g.writeExpr(b, args[0].AsArg().Value(), false, depth); err != nil {
|
||||
return err
|
||||
@@ -892,21 +892,21 @@ func (g *gen) writeBuiltinNumType(b *buffer, recv *a.Expr, method t.ID, args []*
|
||||
func (g *gen) writeBuiltinSlice(b *buffer, recv *a.Expr, method t.ID, args []*a.Node, sideEffectsOnly bool, depth uint32) error {
|
||||
switch method {
|
||||
case t.IDBulkLoadHostEndian:
|
||||
b.writes("wuffs_base__bulk_load_host_endian(")
|
||||
b.writes("wuffs_private_impl__bulk_load_host_endian(")
|
||||
if err := g.writeBuiltinSliceBulkMethodRecv(b, recv, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
return g.writeArgs(b, args, depth)
|
||||
|
||||
case t.IDBulkMemset:
|
||||
b.writes("wuffs_base__bulk_memset(")
|
||||
b.writes("wuffs_private_impl__bulk_memset(")
|
||||
if err := g.writeBuiltinSliceBulkMethodRecv(b, recv, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
return g.writeArgs(b, args, depth)
|
||||
|
||||
case t.IDBulkSaveHostEndian:
|
||||
b.writes("wuffs_base__bulk_save_host_endian(")
|
||||
b.writes("wuffs_private_impl__bulk_save_host_endian(")
|
||||
if err := g.writeBuiltinSliceBulkMethodRecv(b, recv, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -918,7 +918,7 @@ func (g *gen) writeBuiltinSlice(b *buffer, recv *a.Expr, method t.ID, args []*a.
|
||||
}
|
||||
|
||||
// TODO: don't assume that the slice is a slice of base.u8.
|
||||
b.writes("wuffs_base__slice_u8__copy_from_slice(")
|
||||
b.writes("wuffs_private_impl__slice_u8__copy_from_slice(")
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -943,7 +943,7 @@ func (g *gen) writeBuiltinSlice(b *buffer, recv *a.Expr, method t.ID, args []*a.
|
||||
|
||||
case t.IDSuffix:
|
||||
// TODO: don't assume that the slice is a slice of base.u8.
|
||||
b.writes("wuffs_base__slice_u8__suffix(")
|
||||
b.writes("wuffs_private_impl__slice_u8__suffix(")
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1141,7 +1141,7 @@ func (g *gen) writeBuiltinTable(b *buffer, recv *a.Expr, method t.ID, args []*a.
|
||||
|
||||
case t.IDRowU32:
|
||||
// TODO: don't assume that the table is a table of base.u8.
|
||||
b.writes("wuffs_base__table_u8__row_u32(")
|
||||
b.writes("wuffs_private_impl__table_u8__row_u32(")
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, sideEffectsOnly bool, depth u
|
||||
}
|
||||
qid := recvTyp.QID()
|
||||
|
||||
b.printf("wuffs_base__ignore_status("+
|
||||
b.printf("wuffs_private_impl__ignore_status("+
|
||||
"%s%s__initialize(%s", g.packagePrefix(qid), qid[1].Str(g.tm), addr)
|
||||
if err := g.writeExpr(b, recv, false, depth); err != nil {
|
||||
return err
|
||||
|
||||
@@ -162,7 +162,7 @@ func (g *gen) writeStatementAssign1(b *buffer, op t.ID, lhs *a.Expr, rhs *a.Expr
|
||||
if op != t.IDTildeSatPlusEq {
|
||||
uOp = "sub"
|
||||
}
|
||||
b.printf("wuffs_base__u%d__sat_%s_indirect(&", uBits, uOp)
|
||||
b.printf("wuffs_private_impl__u%d__sat_%s_indirect(&", uBits, uOp)
|
||||
opName, closer = ", ", ")"
|
||||
|
||||
case t.IDPlusEq, t.IDMinusEq:
|
||||
@@ -328,7 +328,7 @@ func (g *gen) writeStatementIOManip(b *buffer, n *a.IOManip, depth uint32) error
|
||||
b.printf("%suint8_t *%s%d_%s%s%s = %s%s%s;\n",
|
||||
qualifier, oPrefix, ioBindNum, io2Prefix, prefix, name,
|
||||
io2Prefix, prefix, name)
|
||||
b.printf("%s%s = wuffs_base__io_%s__set("+
|
||||
b.printf("%s%s = wuffs_private_impl__io_%s__set("+
|
||||
"\n&%s%s,\n&%s%s%s,\n&%s%s%s,\n&%s%s%s,\n&%s%s%s,\n",
|
||||
prefix, name, cTyp,
|
||||
uPrefix, name,
|
||||
@@ -352,7 +352,7 @@ func (g *gen) writeStatementIOManip(b *buffer, n *a.IOManip, depth uint32) error
|
||||
}
|
||||
b.printf("%suint8_t *%s%d_%s%s%s = %s%s%s;\n",
|
||||
qualifier, oPrefix, ioBindNum, io2Prefix, prefix, name, io2Prefix, prefix, name)
|
||||
b.printf("wuffs_base__io_%s__limit(&%s%s%s, %s%s%s,\n",
|
||||
b.printf("wuffs_private_impl__io_%s__limit(&%s%s%s, %s%s%s,\n",
|
||||
cTyp,
|
||||
io2Prefix, prefix, name,
|
||||
iopPrefix, prefix, name)
|
||||
@@ -609,7 +609,7 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error {
|
||||
}
|
||||
|
||||
if couldBeSuspension {
|
||||
b.writes("wuffs_base__status__ensure_not_a_suspension(")
|
||||
b.writes("wuffs_private_impl__status__ensure_not_a_suspension(")
|
||||
}
|
||||
if err := g.writeExpr(b, retExpr, false, depth); err != nil {
|
||||
return err
|
||||
@@ -692,7 +692,7 @@ func (g *gen) writeIterateRound(b *buffer, assigns []*a.Node, body []*a.Node, ro
|
||||
vPrefix, name0, iPrefix, name0,
|
||||
length*unroll, length*unroll)
|
||||
} else {
|
||||
b.printf("%s%s.ptr + wuffs_base__iterate_total_advance("+
|
||||
b.printf("%s%s.ptr + wuffs_private_impl__iterate_total_advance("+
|
||||
"(%sslice_%s.len - (size_t)(%s%s.ptr - %sslice_%s.ptr)), %d, %d);\n",
|
||||
vPrefix, name0, iPrefix, name0,
|
||||
vPrefix, name0, iPrefix, name0,
|
||||
|
||||
Reference in new issue
Block a user