Sha256: e6b3d639b42a80b444ed5207b5d1ac5a5b4836925d8bb660f1b4713a833200f8
Contents?: true
Size: 873 Bytes
Versions: 26
Compression:
Stored size: 873 Bytes
Contents
// Protocol Buffers - Google's data interchange format // Copyright 2023 Google LLC. All rights reserved. // https://developers.google.com/protocol-buffers/ /// // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef UPB_BASE_INTERNAL_LOG2_H_ #define UPB_BASE_INTERNAL_LOG2_H_ // Must be last. #include "upb/port/def.inc" #ifdef __cplusplus extern "C" { #endif UPB_INLINE int upb_Log2Ceiling(int x) { if (x <= 1) return 0; #ifdef __GNUC__ return 32 - __builtin_clz(x - 1); #else int lg2 = 0; while ((1 << lg2) < x) lg2++; return lg2; #endif } UPB_INLINE int upb_Log2CeilingSize(int x) { return 1 << upb_Log2Ceiling(x); } #ifdef __cplusplus } /* extern "C" */ #endif #include "upb/port/undef.inc" #endif /* UPB_BASE_INTERNAL_LOG2_H_ */
Version data entries
26 entries across 26 versions & 1 rubygems