| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef WTF_BitwiseOperations_h | 31 #ifndef WTF_BitwiseOperations_h |
| 32 #define WTF_BitwiseOperations_h | 32 #define WTF_BitwiseOperations_h |
| 33 | 33 |
| 34 // DESCRIPTION | 34 // DESCRIPTION |
| 35 // countLeadingZeros() is a bitwise operation that counts the number of leading | 35 // countLeadingZeros() is a bitwise operation that counts the number of leading |
| 36 // zeros in a binary value, starting with the most significant bit. C does not | 36 // zeros in a binary value, starting with the most significant bit. C does not |
| 37 // have an operator to do this, but fortunately the various compilers have | 37 // have an operator to do this, but fortunately the various compilers have |
| 38 // built-ins that map to fast underlying processor instructions. | 38 // built-ins that map to fast underlying processor instructions. |
| 39 | 39 |
| 40 #include "wtf/CPU.h" | 40 #include "sky/engine/wtf/CPU.h" |
| 41 #include "wtf/Compiler.h" | 41 #include "sky/engine/wtf/Compiler.h" |
| 42 | 42 |
| 43 #include <stdint.h> | 43 #include <stdint.h> |
| 44 | 44 |
| 45 namespace WTF { | 45 namespace WTF { |
| 46 | 46 |
| 47 #if COMPILER(GCC) | 47 #if COMPILER(GCC) |
| 48 | 48 |
| 49 // This is very annoying. __builtin_clz has undefined behaviour for an input of | 49 // This is very annoying. __builtin_clz has undefined behaviour for an input of |
| 50 // 0, even though these's clearly a return value that makes sense, and even | 50 // 0, even though these's clearly a return value that makes sense, and even |
| 51 // though nascent processor clz instructions have defined behaviour for 0. | 51 // though nascent processor clz instructions have defined behaviour for 0. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 #else | 70 #else |
| 71 | 71 |
| 72 ALWAYS_INLINE size_t countLeadingZerosSizet(size_t x) { return countLeadingZeros
32(x); } | 72 ALWAYS_INLINE size_t countLeadingZerosSizet(size_t x) { return countLeadingZeros
32(x); } |
| 73 | 73 |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 } // namespace WTF | 76 } // namespace WTF |
| 77 | 77 |
| 78 #endif // WTF_BitwiseOperations_h | 78 #endif // WTF_BitwiseOperations_h |
| OLD | NEW |