================ @@ -0,0 +1,88 @@ +//===-------------------- Bitcastbuffer.cpp ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#include "BitcastBuffer.h" + +using namespace clang; +using namespace clang::interp; + +void BitcastBuffer::pushData(const std::byte *In, size_t BitOffset, + size_t BitWidth, Endian TargetEndianness) { + for (unsigned It = 0; It != BitWidth; ++It) { + bool BitValue = bitof(In, It); + if (!BitValue) + continue; + + unsigned DstBit; + if (TargetEndianness == Endian::Little) + DstBit = BitOffset + It; + else + DstBit = size() - BitOffset - BitWidth + It; + + unsigned DstByte = (DstBit / 8); ---------------- AaronBallman wrote:
Someday we're going to have to search the entire code base for the number 8, aren't we? :-D https://github.com/llvm/llvm-project/pull/116843 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits