ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.h
(Generate patch)

Comparing libecb/ecb.h (file contents):
Revision 1.119 by root, Wed Oct 16 09:01:29 2013 UTC vs.
Revision 1.120 by root, Sat Oct 26 09:13:54 2013 UTC

581 || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 581 || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64
582 #define ECB_STDFP 1 582 #define ECB_STDFP 1
583 #include <string.h> /* for memcpy */ 583 #include <string.h> /* for memcpy */
584#else 584#else
585 #define ECB_STDFP 0 585 #define ECB_STDFP 0
586#endif
587
588#ifndef ECB_NO_LIBM
589
586 #include <math.h> /* for frexp*, ldexp* */ 590 #include <math.h> /* for frexp*, ldexp* */
587#endif
588 591
589#ifndef ECB_NO_LIBM 592 /* converts an ieee half/binary16 to a float */
593 ecb_function_ float ecb_binary16_to_float (uint16_t x) ecb_const;
594 ecb_function_ float
595 ecb_binary16_to_float (uint16_t x)
596 {
597 int e = (x >> 10) & 0x1f;
598 int m = x & 0x3ff;
599 float r;
600
601 if (!e)
602 r = ldexpf (m , -24);
603 else if (e != 31)
604 r = ldexpf (m + 0x400, e - 25);
605 else if (m)
606 #ifdef NAN
607 r = NAN;
608 #endif
609 else
610 r = INFINITY;
611
612 return x & 0x8000 ? -r : r;
613 }
590 614
591 /* convert a float to ieee single/binary32 */ 615 /* convert a float to ieee single/binary32 */
592 ecb_function_ uint32_t ecb_float_to_binary32 (float x) ecb_const; 616 ecb_function_ uint32_t ecb_float_to_binary32 (float x) ecb_const;
593 ecb_function_ uint32_t 617 ecb_function_ uint32_t
594 ecb_float_to_binary32 (float x) 618 ecb_float_to_binary32 (float x)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines