diff --git a/base_c/include/embb/base/c/atomic.h b/base_c/include/embb/base/c/atomic.h index c32e563..ce4ff60 100644 --- a/base_c/include/embb/base/c/atomic.h +++ b/base_c/include/embb/base/c/atomic.h @@ -297,7 +297,6 @@ extern "C" { #ifdef EMBB_THREADING_ANALYSIS_MODE #include -#include int embb_mutex_init( embb_mutex_t* mutex, @@ -332,6 +331,8 @@ void embb_mutex_destroy( #ifdef EMBB_DEBUG +#include + #define EMBB_ATOMIC_INIT_CHECK(variable) assert(variable->marker == 0x12345678) #define EMBB_ATOMIC_INIT_MARKER(variable) variable->marker = 0x12345678 diff --git a/base_c/src/memory_allocation.c b/base_c/src/memory_allocation.c index 07468b2..320ae8f 100644 --- a/base_c/src/memory_allocation.c +++ b/base_c/src/memory_allocation.c @@ -49,8 +49,8 @@ void* embb_alloc(size_t bytes) { if (allocated == NULL) return NULL; - embb_internal__atomic_fetch_and_add_4( - &embb_bytes_allocated, (long)bytes_to_allocate); + embb_internal__atomic_fetch_and_add_4(&embb_bytes_allocated, + (EMBB_BASE_BASIC_TYPE_SIZE_4)bytes_to_allocate); size_t* x_as_size_type = (size_t*)allocated; @@ -72,8 +72,8 @@ void embb_free(void * ptr) { (*alloc_type) = (size_t)INVALID_ALLOCATION; - embb_internal__atomic_fetch_and_add_4( - &embb_bytes_allocated, (long)(0 - (size_t)(*bytes_allocated))); + embb_internal__atomic_fetch_and_add_4(&embb_bytes_allocated, + (EMBB_BASE_BASIC_TYPE_SIZE_4)(0 - (size_t)(*bytes_allocated))); free((size_t*)ptr - 2); } @@ -127,8 +127,8 @@ void* embb_alloc_aligned(size_t alignment, size_t size) { x_as_size_type[-2] = (size_t)allocated; x_as_size_type[-3] = bytes_to_allocate; - embb_internal__atomic_fetch_and_add_4( - &embb_bytes_allocated, (long)bytes_to_allocate); + embb_internal__atomic_fetch_and_add_4(&embb_bytes_allocated, + (EMBB_BASE_BASIC_TYPE_SIZE_4)bytes_to_allocate); return x; } @@ -138,14 +138,14 @@ void embb_free_aligned(void* ptr) { size_t* ptr_conv = (size_t*)ptr; - // If embb_free_aligned is called, the memory block should have been allocated - // using embb_alloc_aligned. + // If embb_free_aligned is called, the memory block should have been + // allocated using embb_alloc_aligned. assert(ptr_conv[-1] == ALIGNED_ALLOCATION); ptr_conv[-1] = (size_t)INVALID_ALLOCATION; - embb_internal__atomic_fetch_and_add_4( - &embb_bytes_allocated, (long)((long)0 - ptr_conv[-3])); + embb_internal__atomic_fetch_and_add_4(&embb_bytes_allocated, + (EMBB_BASE_BASIC_TYPE_SIZE_4)((long)0 - ptr_conv[-3])); free((void*)ptr_conv[-2]); } diff --git a/mtapi_plugins_c/mtapi_network_c/src/embb_mtapi_network.c b/mtapi_plugins_c/mtapi_network_c/src/embb_mtapi_network.c index 9bac593..3e0e43e 100644 --- a/mtapi_plugins_c/mtapi_network_c/src/embb_mtapi_network.c +++ b/mtapi_plugins_c/mtapi_network_c/src/embb_mtapi_network.c @@ -811,13 +811,13 @@ static void network_task_start( int actual = 0; // expected counts bytes we intended to put into the buffer int expected = - 4 + // operation - 4 + // domain_id - 4 + // job_id - 4 + // priority - 4 + 4 + // task handle - 4 + // result_size - 4 + local_task->arguments_size; // arguments buffer + 4 + // operation + 4 + // domain_id + 4 + // job_id + 4 + // priority + 4 + 4 + // task handle + 4 + // result_size + 4 + (int)local_task->arguments_size; // arguments buffer // packet size actual += embb_mtapi_network_buffer_push_back_int32(