| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 word |= ptr[0] << 24; | 533 word |= ptr[0] << 24; |
| 534 return word; | 534 return word; |
| 535 #endif | 535 #endif |
| 536 } | 536 } |
| 537 | 537 |
| 538 | 538 |
| 539 static inline void Store16(byte* ptr, uint16_t value) { | 539 static inline void Store16(byte* ptr, uint16_t value) { |
| 540 #ifdef CAN_READ_UNALIGNED | 540 #ifdef CAN_READ_UNALIGNED |
| 541 *reinterpret_cast<uint16_t*>(ptr) = value; | 541 *reinterpret_cast<uint16_t*>(ptr) = value; |
| 542 #else | 542 #else |
| 543 ptr[1] = value; | 543 // Cast to avoid warning C4244 when compiling with Microsoft Visual C++. |
| 544 ptr[1] = static_cast<byte>(value); |
| 544 ptr[0] = value >> 8; | 545 ptr[0] = value >> 8; |
| 545 #endif | 546 #endif |
| 546 } | 547 } |
| 547 | 548 |
| 548 | 549 |
| 549 static inline void Store32(byte* ptr, uint32_t value) { | 550 static inline void Store32(byte* ptr, uint32_t value) { |
| 550 #ifdef CAN_READ_UNALIGNED | 551 #ifdef CAN_READ_UNALIGNED |
| 551 *reinterpret_cast<uint32_t*>(ptr) = value; | 552 *reinterpret_cast<uint32_t*>(ptr) = value; |
| 552 #else | 553 #else |
| 553 ptr[3] = value; | 554 ptr[3] = value; |
| 554 ptr[2] = value >> 8; | 555 ptr[2] = value >> 8; |
| 555 ptr[1] = value >> 16; | 556 ptr[1] = value >> 16; |
| 556 ptr[0] = value >> 24; | 557 ptr[0] = value >> 24; |
| 557 #endif | 558 #endif |
| 558 } | 559 } |
| 559 | 560 |
| 560 | 561 |
| 561 } } // namespace v8::internal | 562 } } // namespace v8::internal |
| 562 | 563 |
| 563 #endif // V8_UTILS_H_ | 564 #endif // V8_UTILS_H_ |
| OLD | NEW |