Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "simple-allocator.hpp"
- #include <syscalls.hpp>
- #include <cstddef>
- #include <type_traits>
- struct AllocatorState {
- static constexpr size_t kBlockSize = 16;
- static constexpr size_t kPageSize = 1 << 12;
- void* Allocate16() {
- return nullptr; // TODO: remove before flight.
- }
- void Deallocate(void* ptr) {
- (void)ptr; // TODO: remove before flight.
- }
- // TODO: your code here.
- };
- static AllocatorState allocator_state_;
- static_assert(std::is_trivially_constructible_v<AllocatorState>);
- void* Allocate16() {
- return allocator_state_.Allocate16();
- }
- void Deallocate16(void* ptr) {
- allocator_state_.Deallocate(ptr);
- }
Advertisement
Add Comment
Please, Sign In to add comment