Ilya_konstantinov

Untitled

Mar 23rd, 2026
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include "allocator.hpp"
  2.  
  3. #include <syscalls.hpp>
  4.  
  5. #include <type_traits>
  6.  
  7. #include <unused.hpp>  // TODO: remove before flight.
  8.  
  9. static constexpr size_t kPageSize = 1 << 12;
  10.  
  11. // TODO: your code here.
  12.  
  13. struct AllocatorState {
  14.  
  15.     void* Allocate(size_t size) {
  16.         UNUSED(size, kPageSize);  // TODO: remove before flight.
  17.         return nullptr;  // TODO: remove before flight.
  18.     }
  19.  
  20.     void Deallocate(void* ptr) {
  21.         UNUSED(ptr);  // TODO: remove before flight.
  22.     }
  23.  
  24.     // TODO: your code here.
  25. };
  26.  
  27. static_assert(std::is_trivially_constructible_v<AllocatorState>);
  28. static AllocatorState allocator;
  29.  
  30. void* Allocate(size_t size) {
  31.     return allocator.Allocate(size);
  32. }
  33.  
  34. void Deallocate(void* ptr) {
  35.     allocator.Deallocate(ptr);
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment