Author: stefanbidi
Date: Sat Feb 14 00:30:49 2015
New Revision: 38339
URL: http://svn.gna.org/viewcvs/gnustep?rev=38339&view=rev
Log:
* Source/GSUnicode.c: Completed isnan/isinf functions for long double.
Modified:
libs/corebase/trunk/ChangeLog
libs/corebase/trunk/Source/GSUnicode.c
Modified: libs/corebase/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/corebase/trunk/ChangeLog?rev=38339&r1=38338&r2=38339&view=diff
==============================================================================
--- libs/corebase/trunk/ChangeLog (original)
+++ libs/corebase/trunk/ChangeLog Sat Feb 14 00:30:49 2015
@@ -1,3 +1,6 @@
+2014-02-13 Stefan Bidigaray <[email protected]>
+ * Source/GSUnicode.c: Completed isnan/isinf functions for long double.
+
2014-02-12 Stefan Bidigaray <[email protected]>
* Source/config.h.in,
* configure,
Modified: libs/corebase/trunk/Source/GSUnicode.c
URL:
http://svn.gna.org/viewcvs/gnustep/libs/corebase/trunk/Source/GSUnicode.c?rev=38339&r1=38338&r2=38339&view=diff
==============================================================================
--- libs/corebase/trunk/Source/GSUnicode.c (original)
+++ libs/corebase/trunk/Source/GSUnicode.c Sat Feb 14 00:30:49 2015
@@ -1333,27 +1333,63 @@
#endif
l |= (h & 0x000FFFFF);
l |= -l;
- l = 0x7FF00000 - ((h & 0x7FF00000) | ((UInt32) l >> 31));
-
- return (l >> 31) & (h >> 30);
+ l = ((h & 0x7FF00000) ^ 0x7FF00000) - ((UInt32) l >> 31);
+
+ return l & (h >> 30);
}
#if SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE
#if SIZEOF_LONG_DOUBLE == 12
-/* #error 96-bit long double currently not supported! */
-static Boolean
+static int
_ldbl_is_inf (long double d)
{
- return false;
+ SInt32 h;
+ SInt32 m;
+ SInt32 l;
+ SInt32 *dint;
+
+ dint = (SInt32 *) &d;
+#if WORDS_BIGENDIAN
+ l = dint[2];
+ m = dint[1];
+ h = dint[0];
+#else
+ l = dint[0];
+ m = dint[1];
+ h = dint[2];
+#endif
+ l |= (m & 0x7FFFFFFF) | ((h & 0x7FFF) ^ 0x7FFF);
+ l |= -l;
+
+ return ~(l >> 31) & ((h << 16) >> 30);
}
-static Boolean
+static int
_ldbl_is_nan (long double d)
{
- return false;
+ SInt32 h;
+ SInt32 m;
+ SInt32 l;
+ SInt32 *dint;
+
+ dint = (SInt32 *) &d;
+#if WORDS_BIGENDIAN
+ l = dint[2];
+ m = dint[1];
+ h = dint[0];
+#else
+ l = dint[0];
+ m = dint[1];
+ h = dint[2];
+#endif
+ l |= (m & 0x7FFFFFFF);
+ l |= -l;
+ l = ((h & 0x7FFF) ^ 0x7FFF) - ((UInt32)l >> 31);
+
+ return l & ((h << 16) >> 30);
}
#elif SIZEOF_LONG_DOUBLE == 16
-static Boolean
+static int
_ldbl_is_inf (long double d)
{
/* Infinity is defined to be: exponent = 0x7FF, mantissa = 0 */
@@ -1379,14 +1415,14 @@
return ~(l >> 63) & (h >> 62);
}
-static Boolean
+static int
_ldbl_is_nan (long double d)
{
- SInt32 l;
- SInt32 h;
- SInt32 *dint;
-
- dint = (SInt32 *) & d;
+ SInt64 l;
+ SInt64 h;
+ SInt64 *dint;
+
+ dint = (SInt64 *) & d;
#if WORDS_BIGENDIAN
l = dint[1];
h = dint[0];
@@ -1394,11 +1430,11 @@
l = dint[0];
h = dint[1];
#endif
- l |= (h & 0x000FFFFFFFFFFFFF);
+ l |= (h & 0x0000FFFFFFFFFFFF);
l |= -l;
- l = 0x7FF0000000000000 - ((h & 0x7FF0000000000000) | ((UInt32) l >> 63));
-
- return (l >> 63) & (h >> 62);
+ l = ((h & 0x7FFF000000000000) ^ 0x7FFF000000000000) - ((UInt32) l >> 63);
+
+ return l & (h >> 62);
}
#else
#error Unsupported size of long double!
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs