aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/math_test.c
Commit message (Collapse)AuthorAgeFilesLines
* [libc] Add ffs(), ffsl(), and ffsll()Michael Brown2015-03-161-0/+74
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add flsll()Michael Brown2014-04-271-0/+37
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add isqrt() function to find integer square rootsMichael Brown2014-04-261-0/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Check for correct -mrtd assumption on libgcc arithmetic functionsMichael Brown2014-04-261-4/+74
| | | | | | | | | | | | | | | | | | | | | | | | As observed in commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"), recent versions of gcc have changed the semantics of -mrtd as applied to the implicit arithmetic functions. It is possible for tests to succeed even if our assumptions about gcc's interpretation of -mrtd are incorrect. In particular, if gcc chooses to utilise a frame pointer in the calling function, then it can tolerate a temporarily incorrect stack pointer (since the stack pointer will shortly afterwards be restored from the frame pointer anyway). Add tests designed specifically to check that our implementations of the implicit arithmetic functions manipulate the stack pointer as expected by gcc. The effect of these tests can be observed by temporarily reverting commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"): without this fix in place, the tests will fail on gcc 4.7 and later. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add tests for 64-bit divisionMichael Brown2014-04-251-0/+122
| | | | | | | | | | On a 32-bit system, 64-bit division is implemented using the libgcc functions provided in __udivmoddi4.c etc. Calls to these functions are generated automatically by gcc, with a calling convention that is somewhat empirical in nature. Add these self-tests primarily as a check that we are using the correct calling convention. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for flsl()Michael Brown2014-04-241-0/+86
Signed-off-by: Michael Brown <mcb30@ipxe.org>