@@ -19,7 +19,6 @@ public enum FPtoIntegerConversionType
1919 CONVERT_SENTINEL ,
2020 CONVERT_SATURATING ,
2121 CONVERT_NATIVECOMPILERBEHAVIOR ,
22- CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 ,
2322 }
2423
2524 public enum ConversionType
@@ -91,7 +90,6 @@ public static int ConvertDoubleToInt32(double x, FPtoIntegerConversionType t)
9190 return ( Double . IsNaN ( x ) || ( x < int . MinValue ) || ( x > int . MaxValue ) ) ? int . MinValue : ( int ) x ;
9291
9392 case FPtoIntegerConversionType . CONVERT_SATURATING :
94- case FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 :
9593 return Double . IsNaN ( x ) ? 0 : ( x < int . MinValue ) ? int . MinValue : ( x > int . MaxValue ) ? int . MaxValue : ( int ) x ;
9694 }
9795 return 0 ;
@@ -114,7 +112,6 @@ public static uint ConvertDoubleToUInt32(double x, FPtoIntegerConversionType t)
114112 return ( Double . IsNaN ( x ) || ( x < 0 ) || ( x > uint . MaxValue ) ) ? uint . MaxValue : ( uint ) x ;
115113
116114 case FPtoIntegerConversionType . CONVERT_SATURATING :
117- case FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 :
118115 return ( Double . IsNaN ( x ) || ( x < 0 ) ) ? 0 : ( x > uint . MaxValue ) ? uint . MaxValue : ( uint ) x ;
119116 }
120117
@@ -137,29 +134,11 @@ public static long ConvertDoubleToInt64(double x, FPtoIntegerConversionType t)
137134 case FPtoIntegerConversionType . CONVERT_SENTINEL :
138135 return ( Double . IsNaN ( x ) || ( x < long . MinValue ) || ( x >= llong_max_plus_1 ) ) ? long . MinValue : ( long ) x ;
139136
140- case FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 :
141- if ( x > 0 )
142- {
143- return ( long ) CppNativeArm32ConvertDoubleToUInt64 ( x ) ;
144- }
145- else
146- {
147- return - ( long ) CppNativeArm32ConvertDoubleToUInt64 ( - x ) ;
148- }
149-
150137 case FPtoIntegerConversionType . CONVERT_SATURATING :
151138 return Double . IsNaN ( x ) ? 0 : ( x < long . MinValue ) ? long . MinValue : ( x >= llong_max_plus_1 ) ? long . MaxValue : ( long ) x ;
152139 }
153140
154141 return 0 ;
155-
156- static ulong CppNativeArm32ConvertDoubleToUInt64 ( double y )
157- {
158- const double uintmax_plus_1 = - 2.0 * ( double ) int . MinValue ;
159- uint hi32Bits = ConvertDoubleToUInt32 ( y / uintmax_plus_1 , FPtoIntegerConversionType . CONVERT_SATURATING ) ;
160- uint lo32Bits = ConvertDoubleToUInt32 ( y - ( ( ( double ) hi32Bits ) * uintmax_plus_1 ) , FPtoIntegerConversionType . CONVERT_SATURATING ) ;
161- return ( ( ( ulong ) hi32Bits ) << ( int ) 32 ) + lo32Bits ;
162- }
163142 }
164143
165144 public static ulong ConvertDoubleToUInt64 ( double x , FPtoIntegerConversionType t )
@@ -183,18 +162,6 @@ public static ulong ConvertDoubleToUInt64(double x, FPtoIntegerConversionType t)
183162
184163 case FPtoIntegerConversionType . CONVERT_SATURATING :
185164 return ( Double . IsNaN ( x ) || ( x < 0 ) ) ? 0 : ( x >= ullong_max_plus_1 ) ? ulong . MaxValue : ( ulong ) x ;
186-
187- case FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 :
188- {
189- if ( x < two63 )
190- {
191- return ( ulong ) ConvertDoubleToInt64 ( x , FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 ) ;
192- }
193- else
194- {
195- return ( ulong ) ConvertDoubleToInt64 ( x - two63 , FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 ) + ( 0x8000000000000000 ) ;
196- }
197- }
198165 }
199166
200167 return 0 ;
@@ -261,7 +228,6 @@ static void TestBitValue(uint value, double? dblValNullable = null, FPtoIntegerC
261228
262229 if ( ! tValue . HasValue )
263230 {
264- TestBitValue ( value , dblVal , FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 ) ;
265231 TestBitValue ( value , dblVal , FPtoIntegerConversionType . CONVERT_BACKWARD_COMPATIBLE ) ;
266232 TestBitValue ( value , dblVal , FPtoIntegerConversionType . CONVERT_SATURATING ) ;
267233 TestBitValue ( value , dblVal , FPtoIntegerConversionType . CONVERT_SENTINEL ) ;
@@ -355,18 +321,8 @@ static void TestBitValue(uint value, double? dblValNullable = null, FPtoIntegerC
355321 [ Fact ]
356322 public static int TestEntryPoint ( )
357323 {
358- switch ( RuntimeInformation . ProcessArchitecture )
359- {
360- case Architecture . Arm :
361- Program . ManagedConversionRule = FPtoIntegerConversionType . CONVERT_MANAGED_BACKWARD_COMPATIBLE_ARM32 ;
362- break ;
363-
364- case Architecture . X86 :
365- case Architecture . X64 :
366- case Architecture . Arm64 :
367- Program . ManagedConversionRule = FPtoIntegerConversionType . CONVERT_SATURATING ;
368- break ;
369- }
324+ Program . ManagedConversionRule = FPtoIntegerConversionType . CONVERT_SATURATING ;
325+
370326 Console . WriteLine ( $ "Expected managed float behavior is { Program . ManagedConversionRule } Execute with parameter to adjust") ;
371327 Console . WriteLine ( "Specific test cases" ) ;
372328
0 commit comments