[PATCH] [COMPILER-RT] Implement __fixtfsi, __fixunstfsi
Joerg Sonnenberger
joerg at NetBSD.org
Thu May 15 08:23:41 PDT 2014
================
Comment at: lib/builtins/fixtfsi.c:31
@@ +30,3 @@
+ if ((unsigned int)exponent < significandBits) {
+ // value exceed INT_MAX, reuturn INT_MAX
+ if (exponent >= sizeof(int) * CHAR_BIT){
----------------
Typos, see comments below for return value.
================
Comment at: lib/builtins/fixtfsi.c:48
@@ +47,3 @@
+ else {
+ // value exceed INT_MAX, reuturn INT_MAX
+ if (exponent >= sizeof(int) * CHAR_BIT){
----------------
Typo. Doesn't agree with the comment above in that it provides a deterministic value?
================
Comment at: lib/builtins/fixtfsi.c:50
@@ +49,3 @@
+ if (exponent >= sizeof(int) * CHAR_BIT){
+ return sign * 0x7fffffff;
+ }
----------------
Shouldn't this be sign == 1 ? INT_MAX : INT_MIN, otherwise it would return INT_MIN + 1?
================
Comment at: lib/builtins/fixunstfsi.c:26
@@ +25,3 @@
+ * value in long double is representable in su_int or is negative
+ * (no range checking performed)
+ */
----------------
Code does range check?
================
Comment at: lib/builtins/fixunstfsi.c:42
@@ +41,3 @@
+ if (e >= sizeof(su_int) * CHAR_BIT){
+ return 0xffffffff;
+ }
----------------
Typo in comment, please spell the constant as UINT_MAX too.
http://reviews.llvm.org/D2804
More information about the llvm-commits
mailing list