brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · ce0bd5c Raw
35 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8// Wrapper functions and marcos around builtin functions.9//===----------------------------------------------------------------------===//10 11#ifndef LLVM_FUZZER_BUILTINS_H12#define LLVM_FUZZER_BUILTINS_H13 14#include "FuzzerPlatform.h"15 16#if !LIBFUZZER_MSVC17#include <cstdint>18 19#define GET_CALLER_PC() __builtin_return_address(0)20 21namespace fuzzer {22 23inline uint8_t  Bswap(uint8_t x)  { return x; }24inline uint16_t Bswap(uint16_t x) { return __builtin_bswap16(x); }25inline uint32_t Bswap(uint32_t x) { return __builtin_bswap32(x); }26inline uint64_t Bswap(uint64_t x) { return __builtin_bswap64(x); }27 28inline uint32_t Clzll(unsigned long long X) { return __builtin_clzll(X); }29inline int Popcountll(unsigned long long X) { return __builtin_popcountll(X); }30 31}  // namespace fuzzer32 33#endif  // !LIBFUZZER_MSVC34#endif  // LLVM_FUZZER_BUILTINS_H35