brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · a0191ba Raw
44 lines · c
1//===------------------ InterpBuiltinBitCast.h ------------------*- 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 9#ifndef LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H10#define LLVM_CLANG_AST_INTERP_BUILTIN_BIT_CAST_H11 12#include "BitcastBuffer.h"13#include <cstddef>14 15namespace clang {16namespace interp {17class Pointer;18class InterpState;19class CodePtr;20class Context;21 22inline static void swapBytes(std::byte *M, size_t N) {23  for (size_t I = 0; I != (N / 2); ++I)24    std::swap(M[I], M[N - 1 - I]);25}26 27bool DoBitCast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,28               std::byte *Buff, Bits BitWidth, Bits FullBitWidth,29               bool &HasIndeterminateBits);30bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr,31                  Pointer &ToPtr);32bool DoBitCastPtr(InterpState &S, CodePtr OpPC, const Pointer &FromPtr,33                  Pointer &ToPtr, size_t Size);34bool readPointerToBuffer(const Context &Ctx, const Pointer &FromPtr,35                         BitcastBuffer &Buffer, bool ReturnOnUninit);36 37bool DoMemcpy(InterpState &S, CodePtr OpPC, const Pointer &SrcPtr,38              const Pointer &DestPtr, Bits Size);39 40} // namespace interp41} // namespace clang42 43#endif44