Skip to content

Commit

Permalink
[AsmJIT: Const correctness for Block::data()
Browse files Browse the repository at this point in the history
Summary:
The C-style cast was discarding const and casting to `(uint8_t *)` at
the same time, causing a warning. Add const and non-const versions of
the method.

Reviewed By: avp

Differential Revision: D61772029

fbshipit-source-id: b03536b5a0dad20caecdf810d4ed475ab00c88ad
  • Loading branch information
Tzvetan Mikov authored and facebook-github-bot committed Aug 27, 2024
1 parent 505c9dd commit f2dfb64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion external/asmjit/asmjit/src/asmjit/core/zonestack.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class ZoneStackBase {
ASMJIT_INLINE_NODEBUG void setEnd(T* end) noexcept { _end = (void*)end; }

template<typename T>
ASMJIT_INLINE_NODEBUG T* data() const noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); }
ASMJIT_INLINE_NODEBUG const T* data() const noexcept { return (const T*)((const uint8_t*)(this) + sizeof(Block)); }
template<typename T>
ASMJIT_INLINE_NODEBUG T* data() noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); }

template<typename T>
ASMJIT_INLINE_NODEBUG bool canPrepend() const noexcept { return _start > data<void>(); }
Expand Down

0 comments on commit f2dfb64

Please sign in to comment.