Another improvement of gmtime_r()
Freddie Chopin
freddie_chopin@op.pl
Fri Jun 12 17:17:00 GMT 2015
On 27.05.2015 12:32, Corinna Vinschen wrote:
> Thanks. Did you test that this still works on 16 bit machines? A
> comment in the aforementioned document points out that some extra care
> may be required. E.g., EPOCH_ADJUSTMENT_DAYS should probably be
> explicitely defined as long const (like DAYS_PER_ERA, etc).
I don't have access to any 16-bit target, so I did a simpler test - I
just redefined "int", "unsigned" and "long" to int16_t, uint16_t and
uint32_t and tested that on 32-bit ARM target. The original patch indeed
failed such test, but by defining "eraday" to be "unsigned long" instead
of "unsigned" (and adding L suffix to EPOCH_ADJUSTMENT_DAYS as you
suggested) allows such simple test to pass.
I attach improved patch and Changelog entry.
Regards,
FCh
-------------- next part --------------
2015-06-12 Freddie Chopin <freddie_chopin@op.pl>
* libc/time/gmtime_r.c (gmtime_r): use faster algorithm from
civil_from_days() by Howard Hinnant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libc-time-gmtimerc-gmtimer-use-faster-algorithm-from.patch
Type: text/x-patch
Size: 6209 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20150612/dc21bb3d/attachment.bin>
More information about the Newlib
mailing list