Note, BTW, that I have verified that when you printf with %c, it only uses the low 8 bits of the number you pass in. So, you don't need to do any "AND"ing.
On 13.01.2022 14:40, Kenny McCormack wrote:
Note, BTW, that I have verified that when you printf with %c, it only uses >> the low 8 bits of the number you pass in. So, you don't need to do any
"AND"ing.
I also used that assumption in my code upthread but forgot to point
out that this is not reliable or is generally even not true because
that depends on the locale that you have set. Just two samples from
a Unix context...
I get it, but I am not too concerned about it. Since this method already assumes 32 bits and little-endian, I would just add to the list of assumptions: "No goofy locale settings". I.e., it works in the C locale.
Of course, I could make this whole problem go away by writing yet another extension lib to do it - but I was trying to avoid doing that.
On 14.01.2022 15:29, Kenny McCormack wrote:
I get it, but I am not too concerned about it. Since this method already assumes 32 bits and little-endian, I would just add to the list of assumptions: "No goofy locale settings". I.e., it works in the C locale.Fair enough. For others here it might be a fact to consider to not
get surprised.
Of course, I could make this whole problem go away by writing yet another extension lib to do it - but I was trying to avoid doing that.And that (with GNU Awk) would be the way to go.
Janis
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 793 |
Nodes: | 10 (1 / 9) |
Uptime: | 39:59:37 |
Calls: | 11,106 |
Calls today: | 3 |
Files: | 186,086 |
Messages: | 1,751,478 |