| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/base/bits.h" | 5 #include "src/base/bits.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (rhs == -1) return -lhs; | 41 if (rhs == -1) return -lhs; |
| 42 return lhs / rhs; | 42 return lhs / rhs; |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 int32_t SignedMod32(int32_t lhs, int32_t rhs) { | 46 int32_t SignedMod32(int32_t lhs, int32_t rhs) { |
| 47 if (rhs == 0 || rhs == -1) return 0; | 47 if (rhs == 0 || rhs == -1) return 0; |
| 48 return lhs % rhs; | 48 return lhs % rhs; |
| 49 } | 49 } |
| 50 | 50 |
| 51 |
| 52 uint64_t InsertElement64(uint64_t val, uint32_t elm, uint8_t off) { |
| 53 switch (off) { |
| 54 case 0: |
| 55 val &= ~V8_UINT64_C(0xFFFFFFFF); |
| 56 val |= static_cast<uint64_t>(elm) << 0; |
| 57 return val; |
| 58 case 1: |
| 59 val &= V8_UINT64_C(0xFFFFFFFF); |
| 60 val |= static_cast<uint64_t>(elm) << 32; |
| 61 return val; |
| 62 default: |
| 63 UNREACHABLE(); |
| 64 return 0; |
| 65 } |
| 66 } |
| 67 |
| 51 } // namespace bits | 68 } // namespace bits |
| 52 } // namespace base | 69 } // namespace base |
| 53 } // namespace v8 | 70 } // namespace v8 |
| OLD | NEW |