diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index 18df261cf..520f41a8e 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -241,6 +241,7 @@ struct VarStoreInstancer /* https://docs.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#tuplevariationheader */ struct TupleVariationHeader { + friend struct tuple_delta_t; unsigned get_size (unsigned axis_count) const { return min_size + get_all_tuples (axis_count).get_size (); } @@ -384,6 +385,7 @@ struct TupleVariationHeader TupleIndexMask = 0x0FFFu }; + TuppleIndex& operator = (uint16_t i) { HBUINT16::operator= (i); return *this; } DEFINE_SIZE_STATIC (2); }; @@ -416,6 +418,38 @@ struct TupleVariationHeader DEFINE_SIZE_MIN (4); }; +/* not using hb_bytes_t: avoid potential build issues with some compilers */ +struct byte_data_t +{ + hb_bytes_t bytes; + + byte_data_t () = default; + byte_data_t (const char *p_, unsigned len_) : bytes (hb_bytes_t (p_, len_)) {} + + void fini () { bytes.fini (); } + + bool operator == (const byte_data_t& o) const + { return bytes.arrayZ == o.bytes.arrayZ && bytes.length == o.bytes.length; } + + explicit operator bool () const { return bytes.length; } + + void copy (hb_serialize_context_t *c) const + { + if (unlikely (!bytes.length || !bytes.arrayZ)) return; + + char* ret = c->allocate_size (bytes.length); + if (unlikely (!ret)) return; + hb_memcpy (ret, bytes.arrayZ, bytes.length); + } +}; + +enum packed_delta_flag_t +{ + DELTAS_ARE_ZERO = 0x80, + DELTAS_ARE_WORDS = 0x40, + DELTA_RUN_COUNT_MASK = 0x3F +}; + struct tuple_delta_t { public: @@ -428,6 +462,12 @@ struct tuple_delta_t /* empty for cvar tuples */ hb_vector_t deltas_y; + /* compiled data: header and deltas + * compiled point data is saved in a hashmap within tuple_variations_t cause + * some point sets might be reused by different tuple variations */ + hb_vector_t compiled_tuple_header; + hb_vector_t compiled_deltas; + tuple_delta_t () = default; tuple_delta_t (const tuple_delta_t& o) = default; @@ -528,6 +568,322 @@ struct tuple_delta_t return out; } + + /* deltas should be compiled already before we compile tuple + * variation header cause we need to fill in the size of the + * serialized data for this tuple variation */ + //TODO(qxliu):add option to use sharedTuples in gvar + bool compile_tuple_var_header (const hb_map_t& axes_index_map, + unsigned points_data_length, + const hb_map_t& axes_old_index_tag_map) + { + if (!compiled_deltas) return false; + + unsigned cur_axis_count = axes_index_map.get_population (); + /* allocate enough memory: 1 peak + 2 intermediate coords + fixed header size */ + unsigned alloc_len = 3 * cur_axis_count * (F2DOT14::static_size) + 4; + if (unlikely (!compiled_tuple_header.resize (alloc_len))) return false; + + unsigned flag = 0; + /* skip the first 4 header bytes: variationDataSize+tupleIndex */ + F2DOT14* p = reinterpret_cast (compiled_tuple_header.begin () + 4); + F2DOT14* end = reinterpret_cast (compiled_tuple_header.end ()); + hb_array_t coords (p, end - p); + + /* encode peak coords */ + unsigned peak_count = encode_peak_coords(coords, flag, axes_index_map, axes_old_index_tag_map); + if (!peak_count) return false; + + /* encode interim coords, it's optional so returned num could be 0 */ + unsigned interim_count = encode_interm_coords (coords.sub_array (peak_count), flag, axes_index_map, axes_old_index_tag_map); + + //TODO(qxliu): add option to use shared_points in gvar + flag |= TupleVariationHeader::TuppleIndex::PrivatePointNumbers; + + unsigned serialized_data_size = points_data_length + compiled_deltas.length; + TupleVariationHeader *o = reinterpret_cast (compiled_tuple_header.begin ()); + o->varDataSize = serialized_data_size; + o->tupleIndex = flag; + + unsigned total_header_len = 4 + (peak_count + interim_count) * (F2DOT14::static_size); + return compiled_tuple_header.resize (total_header_len); + } + + unsigned encode_peak_coords (hb_array_t peak_coords, + unsigned& flag, + const hb_map_t& axes_index_map, + const hb_map_t& axes_old_index_tag_map) const + { + unsigned orig_axis_count = axes_old_index_tag_map.get_population (); + auto it = peak_coords.iter (); + unsigned count = 0; + for (unsigned i = 0; i < orig_axis_count; i++) + { + if (!axes_index_map.has (i)) /* axis pinned */ + continue; + hb_tag_t axis_tag = axes_old_index_tag_map.get (i); + Triple *coords; + if (!axis_tuples.has (axis_tag, &coords)) + (*it).set_int (0); + else + (*it).set_float (coords->middle); + it++; + count++; + } + flag |= TupleVariationHeader::TuppleIndex::EmbeddedPeakTuple; + return count; + } + + /* if no need to encode intermediate coords, then just return p */ + unsigned encode_interm_coords (hb_array_t coords, + unsigned& flag, + const hb_map_t& axes_index_map, + const hb_map_t& axes_old_index_tag_map) const + { + unsigned orig_axis_count = axes_old_index_tag_map.get_population (); + unsigned cur_axis_count = axes_index_map.get_population (); + + auto start_coords_iter = coords.sub_array (0, cur_axis_count).iter (); + auto end_coords_iter = coords.sub_array (cur_axis_count).iter (); + bool encode_needed = false; + unsigned count = 0; + for (unsigned i = 0; i < orig_axis_count; i++) + { + if (!axes_index_map.has (i)) /* axis pinned */ + continue; + hb_tag_t axis_tag = axes_old_index_tag_map.get (i); + Triple *coords; + float min_val = 0.f, val = 0.f, max_val = 0.f; + if (axis_tuples.has (axis_tag, &coords)) + { + min_val = coords->minimum; + val = coords->middle; + max_val = coords->maximum; + } + + (*start_coords_iter).set_float (min_val); + (*end_coords_iter).set_float (max_val); + + start_coords_iter++; + end_coords_iter++; + count += 2; + if (min_val != hb_min (val, 0.f) || max_val != hb_max (val, 0.f)) + encode_needed = true; + } + + if (encode_needed) + { + flag |= TupleVariationHeader::TuppleIndex::IntermediateRegion; + return count; + } + return 0; + } + + bool compile_deltas () + { + hb_vector_t rounded_deltas; + if (unlikely (!rounded_deltas.alloc (indices.length))) + return false; + + for (unsigned i = 0; i < indices.length; i++) + { + if (!indices[i]) continue; + int rounded_delta = (int) roundf (deltas_x[i]); + rounded_deltas.push (rounded_delta); + } + + if (!rounded_deltas) return false; + /* allocate enough memories 3 * num_deltas */ + unsigned alloc_len = 3 * rounded_deltas.length; + if (deltas_y) + alloc_len *= 2; + + if (unlikely (!compiled_deltas.resize (alloc_len))) return false; + + unsigned i = 0; + unsigned encoded_len = encode_delta_run (i, compiled_deltas.as_array (), rounded_deltas); + + if (deltas_y) + { + /* reuse the rounded_deltas vector, check that deltas_y have the same num of deltas as deltas_x */ + unsigned j = 0; + for (unsigned idx = 0; idx < indices.length; idx++) + { + if (!indices[idx]) continue; + int rounded_delta = (int) roundf (deltas_y[idx]); + + if (j >= rounded_deltas.length) return false; + + rounded_deltas[j++] = rounded_delta; + } + + if (j != rounded_deltas.length) return false; + encoded_len += encode_delta_run (i, compiled_deltas.as_array ().sub_array (encoded_len), rounded_deltas); + } + return compiled_deltas.resize (encoded_len); + } + + unsigned encode_delta_run (unsigned& i, + hb_array_t encoded_bytes, + const hb_vector_t& deltas) const + { + unsigned num_deltas = deltas.length; + unsigned encoded_len = 0; + while (i < num_deltas) + { + int val = deltas[i]; + if (val == 0) + encoded_len += encode_delta_run_as_zeroes (i, encoded_bytes.sub_array (encoded_len), deltas); + else if (val >= -128 && val <= 127) + encoded_len += encode_delta_run_as_bytes (i, encoded_bytes.sub_array (encoded_len), deltas); + else + encoded_len += encode_delta_run_as_words (i, encoded_bytes.sub_array (encoded_len), deltas); + } + return encoded_len; + } + + unsigned encode_delta_run_as_zeroes (unsigned& i, + hb_array_t encoded_bytes, + const hb_vector_t& deltas) const + { + unsigned num_deltas = deltas.length; + unsigned run_length = 0; + auto it = encoded_bytes.iter (); + unsigned encoded_len = 0; + while (i < num_deltas && deltas[i] == 0) + { + i++; + run_length++; + } + + while (run_length >= 64) + { + *it++ = (DELTAS_ARE_ZERO | 63); + run_length -= 64; + encoded_len++; + } + + if (run_length) + { + *it++ = (DELTAS_ARE_ZERO | (run_length - 1)); + encoded_len++; + } + return encoded_len; + } + + unsigned encode_delta_run_as_bytes (unsigned &i, + hb_array_t encoded_bytes, + const hb_vector_t& deltas) const + { + unsigned start = i; + unsigned num_deltas = deltas.length; + while (i < num_deltas) + { + int val = deltas[i]; + if (val > 127 || val < -128) + break; + + /* from fonttools: if there're 2 or more zeros in a sequence, + * it is better to start a new run to save bytes. */ + if (val == 0 && i + 1 < num_deltas && deltas[i+1] == 0) + break; + + i++; + } + unsigned run_length = i - start; + + unsigned encoded_len = 0; + auto it = encoded_bytes.iter (); + + while (run_length >= 64) + { + *it++ = 63; + encoded_len++; + + for (unsigned j = 0; j < 64; j++) + { + *it++ = static_cast (deltas[start + j]); + encoded_len++; + } + + start += 64; + run_length -= 64; + } + + if (run_length) + { + *it++ = run_length - 1; + encoded_len++; + + while (start < i) + { + *it++ = static_cast (deltas[start++]); + encoded_len++; + } + } + + return encoded_len; + } + + unsigned encode_delta_run_as_words (unsigned &i, + hb_array_t encoded_bytes, + const hb_vector_t& deltas) const + { + unsigned start = i; + unsigned num_deltas = deltas.length; + while (i < num_deltas) + { + int val = deltas[i]; + + /* start a new run for a single zero value*/ + if (val == 0) break; + + /* from fonttools: continue word-encoded run if there's only one + * single value in the range [-128, 127] because it is more compact. + * Only start a new run when there're 2 continuous such values. */ + if (val >= -128 && val <= 127 && + i + 1 < num_deltas && + deltas[i+1] >= -128 && deltas[i+1] <= 127) + break; + + i++; + } + + unsigned run_length = i - start; + auto it = encoded_bytes.iter (); + unsigned encoded_len = 0; + while (run_length >= 64) + { + *it++ = (DELTAS_ARE_WORDS | 63); + encoded_len++; + + for (unsigned j = 0; j < 64; j++) + { + int16_t delta_val = deltas[start + j]; + *it++ = static_cast (delta_val >> 8); + *it++ = static_cast (delta_val & 0xFF); + + encoded_len += 2; + } + + start += 64; + run_length -= 64; + } + + if (run_length) + { + *it++ = (DELTAS_ARE_WORDS | (run_length - 1)); + while (start < i) + { + int16_t delta_val = deltas[start++]; + *it++ = static_cast (delta_val >> 8); + *it++ = static_cast (delta_val & 0xFF); + + encoded_len += 2; + } + } + return encoded_len; + } }; struct TupleVariationData @@ -562,7 +918,26 @@ struct TupleVariationData { hb_vector_t tuple_vars; - void fini () { tuple_vars.fini (); } + private: + /* referenced point set->compiled point data map */ + hb_hashmap_t*, byte_data_t> point_data_map; + /* referenced point set-> count map, used in finding shared points */ + hb_hashmap_t*, unsigned> point_set_count_map; + + public: + ~tuple_variations_t () { fini (); } + void fini () + { + for (auto _ : point_data_map.values ()) + _.fini (); + + point_set_count_map.fini (); + tuple_vars.fini (); + } + + unsigned get_var_count () const + { return tuple_vars.length; } + bool create_from_tuple_var_data (tuple_iterator_t iterator, unsigned tuple_var_count, unsigned point_count, @@ -591,7 +966,8 @@ struct TupleVariationData { fini (); return false; } const hb_vector_t &indices = has_private_points ? private_indices : shared_indices; - unsigned num_deltas = indices.length; + bool apply_to_all = (indices.length == 0); + unsigned num_deltas = apply_to_all ? point_count : indices.length; hb_vector_t deltas_x; @@ -618,7 +994,8 @@ struct TupleVariationData for (unsigned i = 0; i < num_deltas; i++) { - unsigned idx = indices[i]; + unsigned idx = apply_to_all ? i : indices[i]; + if (idx >= point_count) continue; var.indices[idx] = true; var.deltas_x[idx] = static_cast (deltas_x[i]); if (is_gvar) @@ -679,6 +1056,205 @@ struct TupleVariationData tuple_vars.fini (); tuple_vars = std::move (new_vars); } + + byte_data_t compile_point_set (const hb_vector_t &point_indices) + { + unsigned num_points = 0; + for (bool i : point_indices) + if (i) num_points++; + + unsigned indices_length = point_indices.length; + /* If the points set consists of all points in the glyph, it's encoded with a + * single zero byte */ + if (num_points == indices_length) + { + char *p = (char *) hb_calloc (1, sizeof (char)); + if (unlikely (!p)) return byte_data_t (); + + return byte_data_t (p, 1); + } + + /* allocate enough memories: 2 bytes for count + 3 bytes for each point */ + unsigned num_bytes = 2 + 3 *num_points; + char *p = (char *) hb_calloc (num_bytes, sizeof (char)); + if (unlikely (!p)) return byte_data_t (); + + unsigned pos = 0; + /* binary data starts with the total number of reference points */ + if (num_points < 0x80) + p[pos++] = num_points; + else + { + p[pos++] = ((num_points >> 8) | 0x80); + p[pos++] = num_points & 0xFF; + } + + const unsigned max_run_length = 0x7F; + unsigned i = 0; + unsigned last_value = 0; + unsigned num_encoded = 0; + while (i < indices_length && num_encoded < num_points) + { + unsigned run_length = 0; + unsigned header_pos = pos; + p[pos++] = 0; + + bool use_byte_encoding = false; + bool new_run = true; + while (i < indices_length && num_encoded < num_points && + run_length <= max_run_length) + { + // find out next referenced point index + while (i < indices_length && !point_indices[i]) + i++; + + if (i >= indices_length) break; + + unsigned cur_value = i; + unsigned delta = cur_value - last_value; + + if (new_run) + { + use_byte_encoding = (delta <= 0xFF); + new_run = false; + } + + if (use_byte_encoding && delta > 0xFF) + break; + + if (use_byte_encoding) + p[pos++] = delta; + else + { + p[pos++] = delta >> 8; + p[pos++] = delta & 0xFF; + } + i++; + last_value = cur_value; + run_length++; + num_encoded++; + } + + if (use_byte_encoding) + p[header_pos] = run_length - 1; + else + p[header_pos] = (run_length - 1) | 0x80; + } + return byte_data_t (p, pos); + } + + /* compile all point set and store byte data in a point_set->byte_data_t hashmap, + * also update point_set->count map, which will be used in finding shared + * point set*/ + bool compile_all_point_sets () + { + for (const auto& tuple: tuple_vars) + { + const hb_vector_t* points_set = &(tuple.indices); + if (point_data_map.has (points_set)) + { + unsigned *count; + if (unlikely (!point_set_count_map.has (points_set, &count) || + !point_set_count_map.set (points_set, (*count) + 1))) + return false; + continue; + } + + byte_data_t compiled_data = compile_point_set (*points_set); + if (unlikely (compiled_data == byte_data_t ())) + return false; + + if (!point_data_map.set (points_set, compiled_data) || + !point_set_count_map.set (points_set, 1)) + return false; + } + return true; + } + + /* find shared points set which saves most bytes */ + byte_data_t find_shared_points () + { + unsigned max_saved_bytes = 0; + byte_data_t res{}; + + for (const auto& _ : point_data_map.iter ()) + { + const hb_vector_t* points_set = _.first; + unsigned data_length = _.second.bytes.length; + unsigned *count; + if (unlikely (!point_set_count_map.has (points_set, &count) || + *count <= 1)) + return byte_data_t (); + + unsigned saved_bytes = data_length * ((*count) -1); + if (saved_bytes > max_saved_bytes) + { + max_saved_bytes = saved_bytes; + res = _.second; + } + } + return res; + } + + void instantiate (const hb_hashmap_t& normalized_axes_location) + { + change_tuple_variations_axis_limits (&normalized_axes_location); + merge_tuple_variations (); + } + + bool compile_bytes (const hb_map_t& axes_index_map, + const hb_map_t& axes_old_index_tag_map) + { + // compile points set and store data in hashmap + if (!compile_all_point_sets ()) + return false; + // compile delta and tuple var header for each tuple variation + for (auto& tuple: tuple_vars) + { + const hb_vector_t* points_set = &(tuple.indices); + byte_data_t *points_data; + if (unlikely (!point_data_map.has (points_set, &points_data))) + return false; + + if (!tuple.compile_deltas ()) + return false; + + if (!tuple.compile_tuple_var_header (axes_index_map, points_data->bytes.length, axes_old_index_tag_map)) + return false; + } + return true; + } + + bool serialize_var_headers (hb_serialize_context_t *c, unsigned& total_header_len) const + { + TRACE_SERIALIZE (this); + for (const auto& tuple: tuple_vars) + { + byte_data_t compiled_bytes {tuple.compiled_tuple_header.arrayZ, tuple.compiled_tuple_header.length}; + compiled_bytes.copy (c); + if (c->in_error ()) return_trace (false); + total_header_len += tuple.compiled_tuple_header.length; + } + return_trace (true); + } + + bool serialize_var_data (hb_serialize_context_t *c) const + { + TRACE_SERIALIZE (this); + for (const auto& tuple: tuple_vars) + { + const hb_vector_t* points_set = &(tuple.indices); + byte_data_t *point_data; + if (!point_data_map.has (points_set, &point_data)) + return_trace (false); + + point_data->copy (c); + byte_data_t compiled_bytes {tuple.compiled_deltas.arrayZ, tuple.compiled_deltas.length}; + compiled_bytes.copy (c); + if (c->in_error ()) return_trace (false); + } + return_trace (true); + } }; struct tuple_iterator_t @@ -808,13 +1384,6 @@ struct TupleVariationData hb_vector_t &deltas /* IN/OUT */, const HBUINT8 *end) { - enum packed_delta_flag_t - { - DELTAS_ARE_ZERO = 0x80, - DELTAS_ARE_WORDS = 0x40, - DELTA_RUN_COUNT_MASK = 0x3F - }; - unsigned i = 0; unsigned count = deltas.length; while (i < count) @@ -867,11 +1436,35 @@ struct TupleVariationData shared_tuples); } + bool serialize (hb_serialize_context_t *c, + bool is_gvar, + tuple_variations_t& tuple_variations) const + { + TRACE_SERIALIZE (this); + auto *out = c->start_embed (this); + if (unlikely (!c->extend_min (out))) return_trace (false); + + if (!c->check_assign (out->tupleVarCount, tuple_variations.get_var_count (), + HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false); + + unsigned total_header_len = 0; + + if (!tuple_variations.serialize_var_headers (c, total_header_len)) + return_trace (false); + + unsigned data_offset = min_size + total_header_len; + if (!is_gvar) data_offset += 4; + if (!c->check_assign (out->data, data_offset, HB_SERIALIZE_ERROR_INT_OVERFLOW)) return_trace (false); + + return tuple_variations.serialize_var_data (c); + } + protected: struct TupleVarCount : HBUINT16 { bool has_shared_point_numbers () const { return ((*this) & SharedPointNumbers); } unsigned int get_count () const { return (*this) & CountMask; } + TupleVarCount& operator = (uint16_t i) { HBUINT16::operator= (i); return *this; } protected: enum Flags diff --git a/src/hb-ot-var-cvar-table.hh b/src/hb-ot-var-cvar-table.hh index c85da7adc..de5433930 100644 --- a/src/hb-ot-var-cvar-table.hh +++ b/src/hb-ot-var-cvar-table.hh @@ -27,6 +27,7 @@ #define HB_OT_VAR_CVAR_TABLE_HH #include "hb-ot-var-common.hh" +#include "hb-ot-var-fvar-table.hh" namespace OT { @@ -64,7 +65,7 @@ struct cvar if (!TupleVariationData::get_tuple_iterator (var_data_bytes, axis_count, this, shared_indices, &iterator)) return false; - + return tupleVariationData.decompile_tuple_variations (point_count, is_gvar, iterator, axes_old_index_tag_map, shared_indices, @@ -125,6 +126,53 @@ struct cvar return true; } + + bool serialize (hb_serialize_context_t *c, + TupleVariationData::tuple_variations_t& tuple_variations) const + { + TRACE_SERIALIZE (this); + if (unlikely (!c->embed (version))) return_trace (false); + + return_trace (tupleVariationData.serialize (c, false, tuple_variations)); + } + + bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + if (c->plan->all_axes_pinned) + return_trace (false); + + /* subset() for cvar is called by partial instancing only, we always pass + * through cvar table in other cases */ + if (!c->plan->normalized_coords) + { + unsigned axis_count = c->plan->source->table.fvar->get_axis_count (); + unsigned total_size = min_size + tupleVariationData.get_size (axis_count); + char *out = c->serializer->allocate_size (total_size); + if (unlikely (!out)) return_trace (false); + + hb_memcpy (out, this, total_size); + return_trace (true); + } + + OT::TupleVariationData::tuple_variations_t tuple_variations; + unsigned axis_count = c->plan->axes_old_index_tag_map.get_population (); + + const hb_tag_t cvt = HB_TAG('c','v','t',' '); + hb_blob_t *cvt_blob = hb_face_reference_table (c->plan->source, cvt); + unsigned point_count = hb_blob_get_length (cvt_blob) / FWORD::static_size; + + if (!decompile_tuple_variations (axis_count, point_count, false, + &(c->plan->axes_old_index_tag_map), + tuple_variations)) + return_trace (false); + + tuple_variations.instantiate (c->plan->axes_location); + if (!tuple_variations.compile_bytes (c->plan->axes_index_map, c->plan->axes_old_index_tag_map)) + return_trace (false); + + return_trace (serialize (c->serializer, tuple_variations)); + } static bool add_cvt_and_apply_deltas (hb_subset_plan_t *plan, const TupleVariationData *tuple_var_data, diff --git a/src/test-tuple-varstore.cc b/src/test-tuple-varstore.cc index 85cccbfba..c1fb747e5 100644 --- a/src/test-tuple-varstore.cc +++ b/src/test-tuple-varstore.cc @@ -110,6 +110,29 @@ test_decompile_cvar () } } + hb_map_t axes_index_map; + axes_index_map.set (0, 0); + bool res = tuple_variations.compile_bytes (axes_index_map, axis_idx_tag_map); + assert (res); + assert (tuple_variations.tuple_vars[0].compiled_tuple_header.length == 6); + const char tuple_var_header_1[] = "\x0\x51\xa0\x0\xc0\x0"; + for (unsigned i = 0; i < 6; i++) + assert(tuple_variations.tuple_vars[0].compiled_tuple_header.arrayZ[i] == tuple_var_header_1[i]); + + assert (tuple_variations.tuple_vars[1].compiled_tuple_header.length == 6); + const char tuple_var_header_2[] = "\x0\x54\xa0\x0\x40\x0"; + for (unsigned i = 0; i < 6; i++) + assert(tuple_variations.tuple_vars[1].compiled_tuple_header.arrayZ[i] == tuple_var_header_2[i]); + + assert (tuple_variations.tuple_vars[0].compiled_deltas.length == 37); + assert (tuple_variations.tuple_vars[1].compiled_deltas.length == 40); + const char compiled_deltas_1[] = "\x0d\xff\x00\xfe\x01\x00\xff\x00\xfe\x01\x00\xed\xed\xf3\xf3\x82\x00\xfe\x84\x06\xfe\x00\x01\xf1\xf1\xf6\xf6\x82\x04\x01\xf1\xf1\xf6\xf6\x82\x00\x01"; + for (unsigned i = 0; i < 37; i++) + assert (tuple_variations.tuple_vars[0].compiled_deltas.arrayZ[i] == compiled_deltas_1[i]); + + const char compiled_deltas_2[] = "\x0d\x01\x00\x04\xfe\x00\x01\x00\x04\xfe\x00\x44\x44\x30\x30\x82\x00\x04\x81\x09\x01\xff\x01\x05\xff\xfc\x33\x33\x25\x25\x82\x04\xff\x33\x33\x25\x25\x82\x00\xff"; + for (unsigned i = 0; i < 40; i++) + assert (tuple_variations.tuple_vars[1].compiled_deltas.arrayZ[i] == compiled_deltas_2[i]); } int