Switch more char/short/int/long to sized type
This commit is contained in:
@ -22,7 +22,7 @@ void BumpAllocator::init() {
|
||||
/* Hier muess Code eingefuegt werden */
|
||||
|
||||
allocations = 0;
|
||||
next = reinterpret_cast<unsigned char*>(heap_start);
|
||||
next = reinterpret_cast<uint8_t*>(heap_start);
|
||||
|
||||
log.info() << "Initialized Bump Allocator" << endl;
|
||||
}
|
||||
@ -37,7 +37,7 @@ void BumpAllocator::dump_free_memory() {
|
||||
/* Hier muess Code eingefuegt werden */
|
||||
|
||||
kout << "Freier Speicher:" << endl
|
||||
<< " - Next: " << hex << reinterpret_cast<unsigned int>(next)
|
||||
<< " - Next: " << hex << reinterpret_cast<uint32_t>(next)
|
||||
<< ", Allocations: " << dec << allocations << endl;
|
||||
}
|
||||
|
||||
@ -46,19 +46,19 @@ void BumpAllocator::dump_free_memory() {
|
||||
*---------------------------------------------------------------------------*
|
||||
* Beschreibung: Einen neuen Speicherblock allozieren. *
|
||||
*****************************************************************************/
|
||||
void* BumpAllocator::alloc(unsigned int req_size) {
|
||||
void* BumpAllocator::alloc(uint32_t req_size) {
|
||||
|
||||
/* Hier muess Code eingefuegt werden */
|
||||
|
||||
log.debug() << "Requested " << hex << req_size << " Bytes" << endl;
|
||||
|
||||
if (req_size + reinterpret_cast<unsigned int>(next) > heap_end) {
|
||||
if (req_size + reinterpret_cast<uint32_t>(next) > heap_end) {
|
||||
log.error() << " - More memory requested than available :(" << endl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* allocated = next;
|
||||
next = reinterpret_cast<unsigned char*>(reinterpret_cast<unsigned int>(next) + req_size);
|
||||
next = reinterpret_cast<uint8_t*>(reinterpret_cast<uint32_t>(next) + req_size);
|
||||
allocations = allocations + 1;
|
||||
|
||||
log.trace() << " - Allocated " << hex << req_size << " Bytes." << endl;
|
||||
@ -72,5 +72,5 @@ void* BumpAllocator::alloc(unsigned int req_size) {
|
||||
* Beschreibung: Nicht implementiert. *
|
||||
*****************************************************************************/
|
||||
void BumpAllocator::free(void* ptr) {
|
||||
log.error() << " mm_free: ptr= " << hex << reinterpret_cast<unsigned int>(ptr) << ", not supported" << endl;
|
||||
log.error() << " mm_free: ptr= " << hex << reinterpret_cast<uint32_t>(ptr) << ", not supported" << endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user