Skip to content

Commit

Permalink
bmalloc bun extras
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed Nov 21, 2024
1 parent ded1209 commit e25af35
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Source/bmalloc/bmalloc/BunExtras.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bit>

#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
#define __bit_cast std::bit_cast
#else
template <
typename Dest, typename Source,
typename std::enable_if<sizeof(Dest) == sizeof(Source) &&
std::is_trivially_copyable<Source>::value &&
std::is_trivially_copyable<Dest>::value,
int>::type = 0>
inline constexpr Dest __bit_cast(const Source &source) {
return __builtin_bit_cast(Dest, source);
}
#endif
1 change: 1 addition & 0 deletions Source/bmalloc/bmalloc/GigacageConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "Algorithm.h"
#include "GigacageKind.h"
#include "BunExtras.h"
#include <bit>
#include <inttypes.h>

Expand Down
1 change: 1 addition & 0 deletions Source/bmalloc/bmalloc/IsoHeapImplInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "IsoTLSDeallocatorEntry.h"
#include "IsoSharedHeapInlines.h"
#include "IsoSharedPageInlines.h"
#include "BunExtras.h"

#if !BUSE(LIBPAS)

Expand Down
1 change: 1 addition & 0 deletions Source/bmalloc/bmalloc/IsoPageInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "IsoHeapImpl.h"
#include "IsoPage.h"
#include "VMAllocate.h"
#include "BunExtras.h"
#include <bit>

#if !BUSE(LIBPAS)
Expand Down
1 change: 1 addition & 0 deletions Source/bmalloc/bmalloc/Packed.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#pragma once

#include "Algorithm.h"
#include "BunExtras.h"
#include <array>
#include <bit>

Expand Down

0 comments on commit e25af35

Please sign in to comment.