File tree Expand file tree Collapse file tree 7 files changed +920
-1063
lines changed
Expand file tree Collapse file tree 7 files changed +920
-1063
lines changed Original file line number Diff line number Diff line change @@ -1103,19 +1103,17 @@ export namespace NativeMath {
11031103 uy &= < u64 > - 1 >> 12 ;
11041104 uy |= 1 << 52 ;
11051105 }
1106- var i : u64 ;
1107- for ( ; ex > ey ; ex -- ) {
1108- i = ux - uy ;
1109- if ( ! ( i >> 63 ) ) {
1110- if ( ! i ) return 0 * x ;
1111- ux = i ;
1106+ while ( ex > ey ) {
1107+ if ( ux >= uy ) {
1108+ if ( ux == uy ) return 0 * x ;
1109+ ux -= uy ;
11121110 }
11131111 ux <<= 1 ;
1112+ -- ex ;
11141113 }
1115- i = ux - uy ;
1116- if ( ! ( i >> 63 ) ) {
1117- if ( ! i ) return 0 * x ;
1118- ux = i ;
1114+ if ( ux >= uy ) {
1115+ if ( ux == uy ) return 0 * x ;
1116+ ux -= uy ;
11191117 }
11201118 // for (; !(ux >> 52); ux <<= 1) --ex;
11211119 var shift = builtin_clz < i64 > ( ux << 11 ) ;
@@ -1160,19 +1158,17 @@ export namespace NativeMath {
11601158 if ( ex + 1 == ey ) break ; // goto end
11611159 return x ;
11621160 }
1163- let i : u64 ;
1164- for ( ; ex > ey ; -- ex ) {
1165- i = uxi - uy ;
1166- if ( i >> 63 == 0 ) {
1167- uxi = i ;
1161+ while ( ex > ey ) {
1162+ if ( uxi >= uy ) {
1163+ uxi -= uy ;
11681164 ++ q ;
11691165 }
11701166 uxi <<= 1 ;
11711167 q <<= 1 ;
1168+ -- ex ;
11721169 }
1173- i = uxi - uy ;
1174- if ( i >> 63 == 0 ) {
1175- uxi = i ;
1170+ if ( uxi >= uy ) {
1171+ uxi -= uy ;
11761172 ++ q ;
11771173 }
11781174 if ( uxi == 0 ) ex = - 60 ;
@@ -2156,19 +2152,17 @@ export namespace NativeMathf {
21562152 uy &= < u32 > - 1 >> 9 ;
21572153 uy |= 1 << 23 ;
21582154 }
2159- var i : u32 ;
2160- for ( ; ex > ey ; -- ex ) {
2161- i = ux - uy ;
2162- if ( ! ( i >> 31 ) ) {
2163- if ( ! i ) return 0 * x ;
2164- ux = i ;
2155+ while ( ex > ey ) {
2156+ if ( ux >= uy ) {
2157+ if ( ux == uy ) return 0 * x ;
2158+ ux -= uy ;
21652159 }
21662160 ux <<= 1 ;
2161+ -- ex ;
21672162 }
2168- i = ux - uy ;
2169- if ( ! ( i >> 31 ) ) {
2170- if ( ! i ) return 0 * x ;
2171- ux = i ;
2163+ if ( ux >= uy ) {
2164+ if ( ux == uy ) return 0 * x ;
2165+ ux -= uy ;
21722166 }
21732167 // for (; !(ux >> 23); ux <<= 1) --ex;
21742168 var shift = < i32 > builtin_clz < u32 > ( ux << 8 ) ;
@@ -2213,19 +2207,17 @@ export namespace NativeMathf {
22132207 if ( ex + 1 == ey ) break ; // goto end
22142208 return x ;
22152209 }
2216- let i : u32 ;
2217- for ( ; ex > ey ; -- ex ) {
2218- i = uxi - uy ;
2219- if ( i >> 31 == 0 ) {
2220- uxi = i ;
2210+ while ( ex > ey ) {
2211+ if ( uxi >= uy ) {
2212+ uxi -= uy ;
22212213 ++ q ;
22222214 }
22232215 uxi <<= 1 ;
22242216 q <<= 1 ;
2217+ -- ex ;
22252218 }
2226- i = uxi - uy ;
2227- if ( i >> 31 == 0 ) {
2228- uxi = i ;
2219+ if ( uxi >= uy ) {
2220+ uxi -= uy ;
22292221 ++ q ;
22302222 }
22312223 if ( uxi == 0 ) ex = - 30 ;
You can’t perform that action at this time.
0 commit comments