Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/utils.h

Issue 196139: X64: Convert smis to holding 32 bits of payload. (Closed)
Patch Set: Addressed review comments. Forwarded to head. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/top.cc ('k') | src/v8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #define V8_UTILS_H_ 29 #define V8_UTILS_H_
30 30
31 #include <stdlib.h> 31 #include <stdlib.h>
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // ---------------------------------------------------------------------------- 36 // ----------------------------------------------------------------------------
37 // General helper functions 37 // General helper functions
38 38
39 // Returns true iff x is a power of 2. Does not work for zero. 39 // Returns true iff x is a power of 2 (or zero). Cannot be used with the
40 // maximally negative value of the type T (the -1 overflows).
40 template <typename T> 41 template <typename T>
41 static inline bool IsPowerOf2(T x) { 42 static inline bool IsPowerOf2(T x) {
42 return (x & (x - 1)) == 0; 43 return (x & (x - 1)) == 0;
43 } 44 }
44 45
45 46
46 // The C++ standard leaves the semantics of '>>' undefined for 47 // The C++ standard leaves the semantics of '>>' undefined for
47 // negative signed operands. Most implementations do the right thing, 48 // negative signed operands. Most implementations do the right thing,
48 // though. 49 // though.
49 static inline int ArithmeticShiftRight(int x, int s) { 50 static inline int ArithmeticShiftRight(int x, int s) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 #endif 573 #endif
573 while (dest < limit) { 574 while (dest < limit) {
574 *dest++ = static_cast<sinkchar>(*src++); 575 *dest++ = static_cast<sinkchar>(*src++);
575 } 576 }
576 } 577 }
577 578
578 579
579 } } // namespace v8::internal 580 } } // namespace v8::internal
580 581
581 #endif // V8_UTILS_H_ 582 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/top.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698