Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_compareNonnormExtF80M.c File Reference
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "softfloat_types.h"
Include dependency graph for s_compareNonnormExtF80M.c:

Go to the source code of this file.

Functions

int softfloat_compareNonnormExtF80M (const struct extFloat80M *aSPtr, const struct extFloat80M *bSPtr)
 

Function Documentation

◆ softfloat_compareNonnormExtF80M()

int softfloat_compareNonnormExtF80M ( const struct extFloat80M * aSPtr,
const struct extFloat80M * bSPtr )

Definition at line 43 of file s_compareNonnormExtF80M.c.

45{
46 uint_fast16_t uiA64, uiB64;
47 uint64_t sigA;
48 bool signB;
49 uint64_t sigB;
50 int32_t expA, expB;
51
52 /*------------------------------------------------------------------------
53 *------------------------------------------------------------------------*/
54 uiA64 = aSPtr->signExp;
55 uiB64 = bSPtr->signExp;
56 sigA = aSPtr->signif;
57 signB = signExtF80UI64( uiB64 );
58 sigB = bSPtr->signif;
59 /*------------------------------------------------------------------------
60 *------------------------------------------------------------------------*/
61 if ( (uiA64 ^ uiB64) & 0x8000 ) {
62 if ( ! (sigA | sigB) ) return 0;
63 goto resultFromSignB;
64 }
65 /*------------------------------------------------------------------------
66 *------------------------------------------------------------------------*/
67 expA = expExtF80UI64( uiA64 );
68 expB = expExtF80UI64( uiB64 );
69 if ( expA == 0x7FFF ) {
70 if (expB == 0x7FFF) return 0;
71 signB = ! signB;
72 goto resultFromSignB;
73 }
74 if ( expB == 0x7FFF ) {
75 goto resultFromSignB;
76 }
77 /*------------------------------------------------------------------------
78 *------------------------------------------------------------------------*/
79 if ( ! expA ) expA = 1;
80 if ( ! (sigA & UINT64_C( 0x8000000000000000 )) ) {
81 if ( sigA ) {
82 expA += softfloat_normExtF80SigM( &sigA );
83 } else {
84 expA = -128;
85 }
86 }
87 if ( ! expB ) expB = 1;
88 if ( ! (sigB & UINT64_C( 0x8000000000000000 )) ) {
89 if ( sigB ) {
90 expB += softfloat_normExtF80SigM( &sigB );
91 } else {
92 expB = -128;
93 }
94 }
95 /*------------------------------------------------------------------------
96 *------------------------------------------------------------------------*/
97 if ( signB ) {
98 if ( expA < expB ) return 1;
99 if ( (expB < expA) || (sigB < sigA) ) return -1;
100 } else {
101 if ( expB < expA ) return 1;
102 if ( (expA < expB) || (sigA < sigB) ) return -1;
103 }
104 return (sigA != sigB);
105 /*------------------------------------------------------------------------
106 *------------------------------------------------------------------------*/
107 resultFromSignB:
108 return signB ? 1 : -1;
109
110}
#define expExtF80UI64(a64)
Definition internals.h:147
#define signExtF80UI64(a64)
Definition internals.h:146
int softfloat_normExtF80SigM(uint64_t *)
uint16_t uint_fast16_t
Definition stdint.h:155
#define UINT64_C(val)
Definition stdint.h:284
signed int int32_t
Definition stdint.h:123
unsigned __int64 uint64_t
Definition stdint.h:136
uint64_t signif
uint16_t signExp