acadia-newlib/newlib/libc/include
imp be517bd298 Ensure that all values of ns, us and ms work
for {n,u,m}stosbt

Integer overflows and wrong constants limited the accuracy of these
functions and created situatiosn where sbttoXs(Xstosbt(Y)) != Y. This
was especailly true in the ns case where we had millions of values
that were wrong.

Instead, used fixed constants because there's no way to say ceil(X)
for integer math. Document what these crazy constants are.

Also, use a shift one fewer left to avoid integer overflow causing
incorrect results, and adjust the equasion accordingly. Document this.

Allow times >= 1s to be well defined for these conversion functions
(at least the Xstosbt). There's too many users in the tree that they
work for >= 1s.

This fixes a failure on boot to program firmware on the mlx4
NIC. There was a msleep(1000) in the code. Prior to my recent rounding
changes, msleep(1000) worked, but msleep(1001) did not because the old
code rounded to just below 2^64 and the new code rounds to just above
it (overflowing, causing the msleep(1000) to really sleep 1ms).

A test program to test all cases will be committed shortly. The test
exaustively tries every value (thanks to bde for the test).

Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D18051
2018-12-04 07:39:15 +01:00
..
machine Move __HAVE_FAST_FMA to math_config.h 2018-07-06 10:29:01 +02:00
rpc ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ssp ssp: fix wchar.h with -std=c99 2018-03-14 10:46:32 -05:00
sys Ensure that all values of ns, us and ms work 2018-12-04 07:39:15 +01:00
_ansi.h ansification: remove _HAVE_STDC 2018-01-17 11:47:30 -06:00
_newlib_version.h
_syslist.h
alloca.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ar.h
argz.h
assert.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
complex.h Fixed warnings for some long double complex methods 2017-07-05 14:40:02 +02:00
cpio.h
ctype.h Use !__HAVE_LOCALE_INFO__ define to use _ctype_ directly [v2] 2018-09-06 14:19:53 +02:00
devctl.h devctl.h: Fix typo and include proper header 2017-01-25 12:37:19 +01:00
dirent.h Move common <sys/dirent.h> content to <dirent.h> 2018-10-11 08:29:16 +02:00
elf.h Add the Aarch64 SVE specific HWCAP_SVE define 2017-11-22 14:10:37 -05:00
envlock.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
envz.h
errno.h
fastmath.h
fcntl.h
fnmatch.h
getopt.h newlib: getopt now permutes multi-flag options correctly 2018-06-18 18:45:44 +02:00
glob.h
grp.h
iconv.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ieeefp.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
inttypes.h Importing wcstoumax inttypes method from FreeBSD. 2017-08-02 13:02:26 +02:00
langinfo.h Add __nl_item to <sys/_types.h> and use it 2018-08-24 15:00:01 +02:00
libgen.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
limits.h Include sys/syslimits.h in limits.h 2018-09-06 14:11:45 +02:00
locale.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
malloc.h Add prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this from nano-mallocr.c 2018-02-16 12:16:07 +01:00
math.h ansification: remove _PARAMS 2018-01-17 11:47:13 -06:00
memory.h Provide <memory.h> 2016-11-22 14:21:35 +01:00
newlib.h
paths.h
pthread.h Correct prototypes of pthread_mutex_getprioceiling() and pthread_setschedparam() 2018-03-15 09:25:45 -05:00
pwd.h
reent.h ansification: remove _PARAMS 2018-01-17 11:47:13 -06:00
regdef.h
regex.h
sched.h Declare GNU-specific sched_getcpu() 2018-08-07 14:34:11 +02:00
search.h
setjmp.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
signal.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
spawn.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
stdatomic.h
stdint.h Provide __intmax_t and __uintmax_t 2016-10-25 16:24:05 +02:00
stdio.h stdio.h: Expose cuserid with __GNU_VISIBLE 2018-11-29 11:22:42 +01:00
stdio_ext.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
stdlib.h Fix posix_memalign() attributes 2018-10-22 11:26:39 +02:00
string.h Add attributes to malloc-like functions 2018-10-10 07:40:06 +02:00
strings.h ssp: add Object Size Checking for strings.h 2017-11-29 11:25:41 -06:00
tar.h
termios.h
tgmath.h
threads.h
time.h time.h: Introduce Linux-specific CLOCK id values 2018-11-29 10:01:57 +01:00
unctrl.h ansification: remove _CONST 2018-01-17 11:47:08 -06:00
unistd.h
utime.h
utmp.h
wchar.h Add attributes to malloc-like functions 2018-10-10 07:40:06 +02:00
wctype.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
wordexp.h
xlocale.h Rename <sys/_locale.h> to <xlocale.h> 2017-03-22 10:03:45 +01:00