1 //===-- scudo_utils.h -------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 /// Header for scudo_utils.cpp.
11 //===----------------------------------------------------------------------===//
13 #ifndef SCUDO_UTILS_H_
14 #define SCUDO_UTILS_H_
16 #include "sanitizer_common/sanitizer_common.h"
22 template <class Dest, class Source>
23 INLINE Dest bit_cast(const Source& source) {
24 static_assert(sizeof(Dest) == sizeof(Source), "Sizes are not equal!");
26 memcpy(&dest, &source, sizeof(dest));
30 void NORETURN dieWithMessage(const char *Format, ...);
32 bool hasHardwareCRC32();
34 } // namespace __scudo
36 #endif // SCUDO_UTILS_H_