Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / tools / fuzzing / libfuzzer / FuzzerBuiltins.h
blob4c0ada82662ddf318e50d2c712769ee56b13de7f
1 //===- FuzzerBuiltins.h - Internal header for builtins ----------*- C++ -* ===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // Wrapper functions and marcos around builtin functions.
9 //===----------------------------------------------------------------------===//
11 #ifndef LLVM_FUZZER_BUILTINS_H
12 #define LLVM_FUZZER_BUILTINS_H
14 #include "FuzzerPlatform.h"
16 #if !LIBFUZZER_MSVC
17 #include <cstdint>
19 #define GET_CALLER_PC() __builtin_return_address(0)
21 namespace fuzzer {
23 inline uint8_t Bswap(uint8_t x) { return x; }
24 inline uint16_t Bswap(uint16_t x) { return __builtin_bswap16(x); }
25 inline uint32_t Bswap(uint32_t x) { return __builtin_bswap32(x); }
26 inline uint64_t Bswap(uint64_t x) { return __builtin_bswap64(x); }
28 inline uint32_t Clzll(unsigned long long X) { return __builtin_clzll(X); }
29 inline uint32_t Clz(unsigned long long X) { return __builtin_clz(X); }
30 inline int Popcountll(unsigned long long X) { return __builtin_popcountll(X); }
32 } // namespace fuzzer
34 #endif // !LIBFUZZER_MSVC
35 #endif // LLVM_FUZZER_BUILTINS_H