File: floatunsisf.c

package info (click to toggle)
gccxml 0.9.0%2Bcvs20080525-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 78,840 kB
  • ctags: 72,674
  • sloc: ansic: 749,255; cpp: 33,564; asm: 26,833; sh: 5,161; makefile: 4,695; lex: 589; awk: 566; perl: 334; yacc: 271; pascal: 86; python: 18
file content (18 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Public domain.  */
typedef int SItype __attribute__ ((mode (SI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef float SFtype __attribute__ ((mode (SF)));

SFtype
__floatunsisf (USItype u)
{
  SItype s = (SItype) u;
  if (s < 0)
    {
      /* As in expand_float, compute (u & 1) | (u >> 1) to ensure
         correct rounding if a nonzero bit is shifted out.  */
      return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1));
    }
  else
    return (SFtype) s;
}