| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 | 65 |
| 66 static inline double rawbits_to_double(uint64_t bits) { | 66 static inline double rawbits_to_double(uint64_t bits) { |
| 67 double value = 0.0; | 67 double value = 0.0; |
| 68 memcpy(&value, &bits, 8); | 68 memcpy(&value, &bits, 8); |
| 69 return value; | 69 return value; |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 // Bits counting. | 73 // Bits counting. |
| 74 int CountLeadingZeros(uint64_t value, int width); | 74 inline int MaskToBit(uint64_t mask) { |
| 75 int CountLeadingSignBits(int64_t value, int width); | 75 ASSERT(CountSetBits(mask, 64) == 1); |
| 76 int CountTrailingZeros(uint64_t value, int width); | 76 return CountTrailingZeros(mask, 64); |
| 77 int CountSetBits(uint64_t value, int width); | 77 } |
| 78 int MaskToBit(uint64_t mask); | |
| 79 | 78 |
| 80 | 79 |
| 81 // NaN tests. | 80 // NaN tests. |
| 82 inline bool IsSignallingNaN(double num) { | 81 inline bool IsSignallingNaN(double num) { |
| 83 const uint64_t kFP64QuietNaNMask = 0x0008000000000000UL; | 82 const uint64_t kFP64QuietNaNMask = 0x0008000000000000UL; |
| 84 uint64_t raw = double_to_rawbits(num); | 83 uint64_t raw = double_to_rawbits(num); |
| 85 if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) { | 84 if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) { |
| 86 return true; | 85 return true; |
| 87 } | 86 } |
| 88 return false; | 87 return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 100 | 99 |
| 101 | 100 |
| 102 template <typename T> | 101 template <typename T> |
| 103 inline bool IsQuietNaN(T num) { | 102 inline bool IsQuietNaN(T num) { |
| 104 return std::isnan(num) && !IsSignallingNaN(num); | 103 return std::isnan(num) && !IsSignallingNaN(num); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } } // namespace v8::internal | 106 } } // namespace v8::internal |
| 108 | 107 |
| 109 #endif // V8_A64_UTILS_A64_H_ | 108 #endif // V8_A64_UTILS_A64_H_ |
| OLD | NEW |