Skip to content

Commit eaebf9e

Browse files
committed
ICU-23121 Export compressibleBytes as bools instead of packed u8
1 parent 353866d commit eaebf9e

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

icu4c/source/tools/genrb/parse.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,15 +1026,6 @@ writeCollationSpecialPrimariesTOML(const char* outputdir, const char* name, cons
10261026
lastPrimaries[i] = static_cast<uint16_t>((data->getLastPrimaryForGroup(UCOL_REORDER_CODE_FIRST + i) + 1) >> 16);
10271027
}
10281028

1029-
uint8_t compressibleBytes[32] = {};
1030-
for (int32_t i = 0; i < 256; ++i) {
1031-
if (data->compressibleBytes[i]) {
1032-
int32_t arrIndex = i >> 3;
1033-
uint8_t mask = (1 << (i & 7));
1034-
compressibleBytes[arrIndex] |= mask;
1035-
}
1036-
}
1037-
10381029
uint32_t numericPrimary = data->numericPrimary;
10391030
if (numericPrimary & 0xFFFFFF) {
10401031
printf("Lower 24 bits set in numeric primary");
@@ -1043,7 +1034,7 @@ writeCollationSpecialPrimariesTOML(const char* outputdir, const char* name, cons
10431034
}
10441035

10451036
usrc_writeArray(f, "last_primaries = [\n ", lastPrimaries, 16, 4, " ", "\n]\n");
1046-
usrc_writeArray(f, "compressible_bytes = [\n ", compressibleBytes, 8, 32, " ", "\n]\n");
1037+
usrc_writeArray(f, "compressible_bytes = [\n ", data->compressibleBytes, 1, 256, " ", "\n]\n");
10471038
fprintf(f, "numeric_primary = 0x%X\n", numericPrimary >> 24);
10481039
fclose(f);
10491040
}

icu4c/source/tools/toolutil/writesrc.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ usrc_writeArray(FILE *f,
162162
p32=nullptr;
163163
p64=nullptr;
164164
switch(width) {
165+
case 1:
165166
case 8:
166167
p8=(const uint8_t *)p;
167168
break;
@@ -192,6 +193,7 @@ usrc_writeArray(FILE *f,
192193
}
193194
}
194195
switch(width) {
196+
case 1:
195197
case 8:
196198
value=p8[i];
197199
break;
@@ -208,7 +210,11 @@ usrc_writeArray(FILE *f,
208210
value=0; /* unreachable */
209211
break;
210212
}
211-
fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
213+
if (width == 1) {
214+
fprintf(f, value ? "true" : "false");
215+
} else {
216+
fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
217+
}
212218
}
213219
if(postfix!=nullptr) {
214220
fputs(postfix, f);

0 commit comments

Comments
 (0)