person pointers
parent
7fa5e462df
commit
0b6dfa6f87
2
libs/BLT
2
libs/BLT
|
@ -1 +1 @@
|
|||
Subproject commit 68f6a0af44fe8ba5044a7f37b8bac9809ab709f1
|
||||
Subproject commit 8af1db43c3dd8a260729030365a4eabc8246ccf6
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
|
||||
#include <lilfbtf/lilfbtf.h>
|
||||
#include <blt/std/allocator.h>
|
||||
#include <blt/std/simd.h>
|
||||
|
||||
namespace lilfb
|
||||
{
|
||||
|
|
|
@ -1,7 +1,39 @@
|
|||
#include <iostream>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <blt/std/logging.h>
|
||||
|
||||
struct data {
|
||||
float f;
|
||||
int i;
|
||||
char c;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
size_t size = 32;
|
||||
size_t remaining_bytes = size;
|
||||
size_t offset = 0;
|
||||
void* void_ptr = nullptr;
|
||||
char* new_ptr = nullptr;
|
||||
char* buffer = new char[size];
|
||||
|
||||
remaining_bytes = size - offset;
|
||||
std::cout << static_cast<void*>(buffer) << " ' " << remaining_bytes << std::endl;
|
||||
void_ptr = reinterpret_cast<void*>(&buffer[offset]);
|
||||
new_ptr = static_cast<char*>(std::align(alignof(char), sizeof(char), void_ptr, remaining_bytes));
|
||||
std::cout << static_cast<void*>(new_ptr) << " : " << remaining_bytes << " | " << (buffer - new_ptr + sizeof(char)) << std::endl;
|
||||
offset += (buffer - new_ptr + sizeof(char));
|
||||
|
||||
remaining_bytes = size - offset;
|
||||
void_ptr = reinterpret_cast<void*>(&buffer[offset]);
|
||||
new_ptr = static_cast<char*>(std::align(alignof(data), sizeof(data), void_ptr, remaining_bytes));
|
||||
std::cout << static_cast<void*>(new_ptr) << " : " << remaining_bytes << " | " << (buffer - new_ptr + sizeof(data)) << std::endl;
|
||||
offset += (buffer - new_ptr + sizeof(data));
|
||||
|
||||
|
||||
delete[](buffer);
|
||||
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue