This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <memory> | |
| void* AlignedMalloc(const size_t size, const size_t alignment) | |
| { | |
| const size_t offset = alignment - 1 + sizeof(void*); | |
| void* buffer = malloc(size + offset); | |
| void** ptr = reinterpret_cast<void**>((reinterpret_cast<size_t>(buffer) + offset) & ~(alignment - 1)); | |
| ptr[-1] = buffer; | |
| return ptr; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| ##### CHECK PARAMETERS ##### | |
| PRODUCTION=0 | |
| while [[ "$#" -gt 0 ]]; do | |
| case $1 in | |
| -p|--production) PRODUCTION=1 ;; | |
| *) echo "Unknown parameter passed: $1"; exit 1 ;; | |
| esac | |
| shift |