… | |
… | |
373 | |
373 | |
374 | =head2 OPTIMISATION HINTS |
374 | =head2 OPTIMISATION HINTS |
375 | |
375 | |
376 | =over 4 |
376 | =over 4 |
377 | |
377 | |
378 | =item bool ecb_is_constant(expr) |
378 | =item bool ecb_is_constant (expr) |
379 | |
379 | |
380 | Returns true iff the expression can be deduced to be a compile-time |
380 | Returns true iff the expression can be deduced to be a compile-time |
381 | constant, and false otherwise. |
381 | constant, and false otherwise. |
382 | |
382 | |
383 | For example, when you have a C<rndm16> function that returns a 16 bit |
383 | For example, when you have a C<rndm16> function that returns a 16 bit |
… | |
… | |
685 | /* this results in a single add instruction to toggle the bit, and 4 extra */ |
685 | /* this results in a single add instruction to toggle the bit, and 4 extra */ |
686 | /* instructions to move the float value to an integer register and back. */ |
686 | /* instructions to move the float value to an integer register and back. */ |
687 | |
687 | |
688 | x = ecb_binary32_to_float (ecb_float_to_binary32 (x) ^ 0x80000000U) |
688 | x = ecb_binary32_to_float (ecb_float_to_binary32 (x) ^ 0x80000000U) |
689 | |
689 | |
|
|
690 | =item float ecb_binary16_to_float (uint16_t x) [-UECB_NO_LIBM] |
|
|
691 | |
690 | =item float ecb_binary32_to_float (uint32_t x) [-UECB_NO_LIBM] |
692 | =item float ecb_binary32_to_float (uint32_t x) [-UECB_NO_LIBM] |
691 | |
693 | |
692 | =item double ecb_binary32_to_double (uint64_t x) [-UECB_NO_LIBM] |
694 | =item double ecb_binary32_to_double (uint64_t x) [-UECB_NO_LIBM] |
693 | |
695 | |
694 | The reverse operation of the previos function - takes the bit representation |
696 | The reverse operation of the previos function - takes the bit |
695 | of an IEEE binary32 or binary64 number and converts it to the native C<float> |
697 | representation of an IEEE binary16, binary32 or binary64 number and |
696 | or C<double> format. |
698 | converts it to the native C<float> or C<double> format. |
697 | |
699 | |
698 | This function should work even when the native floating point format isn't |
700 | This function should work even when the native floating point format isn't |
699 | IEEE compliant, of course at a speed and code size penalty, and of course |
701 | IEEE compliant, of course at a speed and code size penalty, and of course |
700 | also within reasonable limits (it tries to convert normals and denormals, |
702 | also within reasonable limits (it tries to convert normals and denormals, |
701 | and might be lucky for infinities, and with extraordinary luck, also for |
703 | and might be lucky for infinities, and with extraordinary luck, also for |