The dart-more package uses the following scheme to encode Unicode properties and other Unicode data:
https://github.com/renggli/dart-more/blob/8d6470cebeb11887fc5f8fb54386429e924700cd/bin/generate_unicode.dart#L20-L33
-
Generate a list of length 0x10ffff, filled with zeros
Each bit in the numbers encodes the presence of a given property. For us, first bit is inclusion in e.g. iOS 8.0, second bit is iOS 8.1, etc. (Note: Up to 32 bits because on web JavaScript bitwise operations are limited to 32 bits)
-
Loop over the data, setting all the bits. When we hit more than 32 properties, we make a new list.
iOS has 65 releases covered, so we would need three lists. However only 22 releases have distinct data, so we could instead have a separate expansion mapping exemplar releases to a span of releases.
-
Compress the lists with run-length encoding
-
Store the compressed lists as generated source files
-
In the app, decode the lists and use bitwise operations to test inclusion
The dart-more package uses the following scheme to encode Unicode properties and other Unicode data:
https://github.com/renggli/dart-more/blob/8d6470cebeb11887fc5f8fb54386429e924700cd/bin/generate_unicode.dart#L20-L33
Generate a list of length 0x10ffff, filled with zeros
Each bit in the numbers encodes the presence of a given property. For us, first bit is inclusion in e.g. iOS 8.0, second bit is iOS 8.1, etc. (Note: Up to 32 bits because on web JavaScript bitwise operations are limited to 32 bits)
Loop over the data, setting all the bits. When we hit more than 32 properties, we make a new list.
iOS has 65 releases covered, so we would need three lists. However only 22 releases have distinct data, so we could instead have a separate expansion mapping exemplar releases to a span of releases.
Compress the lists with run-length encoding
Store the compressed lists as generated source files
In the app, decode the lists and use bitwise operations to test inclusion