Commit 30e7a22eba59bcf92c761400c93d35b902878b46
1 parent
9208f2f7
Use float_relation_* constants
Use float_relation_* constants rather than magic numbers in softfloat-native comparison routines. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6025 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
24 additions
and
24 deletions
fpu/softfloat-native.c
@@ -220,25 +220,25 @@ float32 float32_sqrt( float32 a STATUS_PARAM) | @@ -220,25 +220,25 @@ float32 float32_sqrt( float32 a STATUS_PARAM) | ||
220 | int float32_compare( float32 a, float32 b STATUS_PARAM ) | 220 | int float32_compare( float32 a, float32 b STATUS_PARAM ) |
221 | { | 221 | { |
222 | if (a < b) { | 222 | if (a < b) { |
223 | - return -1; | 223 | + return float_relation_less; |
224 | } else if (a == b) { | 224 | } else if (a == b) { |
225 | - return 0; | 225 | + return float_relation_equal; |
226 | } else if (a > b) { | 226 | } else if (a > b) { |
227 | - return 1; | 227 | + return float_relation_greater; |
228 | } else { | 228 | } else { |
229 | - return 2; | 229 | + return float_relation_unordered; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | int float32_compare_quiet( float32 a, float32 b STATUS_PARAM ) | 232 | int float32_compare_quiet( float32 a, float32 b STATUS_PARAM ) |
233 | { | 233 | { |
234 | if (isless(a, b)) { | 234 | if (isless(a, b)) { |
235 | - return -1; | 235 | + return float_relation_less; |
236 | } else if (a == b) { | 236 | } else if (a == b) { |
237 | - return 0; | 237 | + return float_relation_equal; |
238 | } else if (isgreater(a, b)) { | 238 | } else if (isgreater(a, b)) { |
239 | - return 1; | 239 | + return float_relation_greater; |
240 | } else { | 240 | } else { |
241 | - return 2; | 241 | + return float_relation_unordered; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | int float32_is_signaling_nan( float32 a1) | 244 | int float32_is_signaling_nan( float32 a1) |
@@ -391,25 +391,25 @@ float64 float64_sqrt( float64 a STATUS_PARAM) | @@ -391,25 +391,25 @@ float64 float64_sqrt( float64 a STATUS_PARAM) | ||
391 | int float64_compare( float64 a, float64 b STATUS_PARAM ) | 391 | int float64_compare( float64 a, float64 b STATUS_PARAM ) |
392 | { | 392 | { |
393 | if (a < b) { | 393 | if (a < b) { |
394 | - return -1; | 394 | + return float_relation_less; |
395 | } else if (a == b) { | 395 | } else if (a == b) { |
396 | - return 0; | 396 | + return float_relation_equal; |
397 | } else if (a > b) { | 397 | } else if (a > b) { |
398 | - return 1; | 398 | + return float_relation_greater; |
399 | } else { | 399 | } else { |
400 | - return 2; | 400 | + return float_relation_unordered; |
401 | } | 401 | } |
402 | } | 402 | } |
403 | int float64_compare_quiet( float64 a, float64 b STATUS_PARAM ) | 403 | int float64_compare_quiet( float64 a, float64 b STATUS_PARAM ) |
404 | { | 404 | { |
405 | if (isless(a, b)) { | 405 | if (isless(a, b)) { |
406 | - return -1; | 406 | + return float_relation_less; |
407 | } else if (a == b) { | 407 | } else if (a == b) { |
408 | - return 0; | 408 | + return float_relation_equal; |
409 | } else if (isgreater(a, b)) { | 409 | } else if (isgreater(a, b)) { |
410 | - return 1; | 410 | + return float_relation_greater; |
411 | } else { | 411 | } else { |
412 | - return 2; | 412 | + return float_relation_unordered; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | int float64_is_signaling_nan( float64 a1) | 415 | int float64_is_signaling_nan( float64 a1) |
@@ -483,25 +483,25 @@ floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM) | @@ -483,25 +483,25 @@ floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM) | ||
483 | int floatx80_compare( floatx80 a, floatx80 b STATUS_PARAM ) | 483 | int floatx80_compare( floatx80 a, floatx80 b STATUS_PARAM ) |
484 | { | 484 | { |
485 | if (a < b) { | 485 | if (a < b) { |
486 | - return -1; | 486 | + return float_relation_less; |
487 | } else if (a == b) { | 487 | } else if (a == b) { |
488 | - return 0; | 488 | + return float_relation_equal; |
489 | } else if (a > b) { | 489 | } else if (a > b) { |
490 | - return 1; | 490 | + return float_relation_greater; |
491 | } else { | 491 | } else { |
492 | - return 2; | 492 | + return float_relation_unordered; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM ) | 495 | int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM ) |
496 | { | 496 | { |
497 | if (isless(a, b)) { | 497 | if (isless(a, b)) { |
498 | - return -1; | 498 | + return float_relation_less; |
499 | } else if (a == b) { | 499 | } else if (a == b) { |
500 | - return 0; | 500 | + return float_relation_equal; |
501 | } else if (isgreater(a, b)) { | 501 | } else if (isgreater(a, b)) { |
502 | - return 1; | 502 | + return float_relation_greater; |
503 | } else { | 503 | } else { |
504 | - return 2; | 504 | + return float_relation_unordered; |
505 | } | 505 | } |
506 | } | 506 | } |
507 | int floatx80_is_signaling_nan( floatx80 a1) | 507 | int floatx80_is_signaling_nan( floatx80 a1) |