comment, test Ofast/s/z

This commit is contained in:
Gregory Burd 2024-08-03 00:59:17 -04:00
parent b98111b7df
commit 061f566264
2 changed files with 16 additions and 4 deletions

View file

@ -15,7 +15,7 @@ set(SOURCE_DIR .)
set(HEADER_DIR . test) set(HEADER_DIR . test)
set(COMMON_CMAKE_C_FLAGS "-std=c11 -Wall -Wextra -Wpedantic") set(COMMON_CMAKE_C_FLAGS "-std=c11 -Wall -Wextra -Wpedantic")
set(CMAKE_C_FLAGS_DEBUG "-DSPARSEMAP_DIAGNOSTIC -DSPARSEMAP_TESTING -DDEBUG -g -O0") set(CMAKE_C_FLAGS_DEBUG "-DSPARSEMAP_DIAGNOSTIC -DSPARSEMAP_TESTING -DDEBUG -g -Og")
set(CMAKE_C_FLAGS_PROFILE "-DSPARSEMAP_DIAGNOSTIC -DSPARSEMAP_TESTING -DDEBUG -g -Og -fsanitize=address,leak,object-size,pointer-compare,pointer-subtract,null,return,bounds,pointer-overflow,undefined -fsanitize-address-use-after-scope") set(CMAKE_C_FLAGS_PROFILE "-DSPARSEMAP_DIAGNOSTIC -DSPARSEMAP_TESTING -DDEBUG -g -Og -fsanitize=address,leak,object-size,pointer-compare,pointer-subtract,null,return,bounds,pointer-overflow,undefined -fsanitize-address-use-after-scope")
set(CMAKE_C_FLAGS_RELEASE "-Ofast") set(CMAKE_C_FLAGS_RELEASE "-Ofast")

View file

@ -1090,8 +1090,18 @@ __sm_get_chunk_data(sparsemap_t *map, size_t offset)
return &map->m_data[SM_SIZEOF_OVERHEAD + offset]; return &map->m_data[SM_SIZEOF_OVERHEAD + offset];
} }
/** @brief /** @brief Either max capacity or limited by next chunk.
* TODO only call this with an offset of an RLE chunk *
* Use this function to determine the available room (capacity) in bits between
* the end of an RLE chunk and the beginning of the next chunk (if one exists).
* This function will assume that \b offset is the location of an RLE chunk and
* then using that probe for the start of the next chunk.
*
* @param[in] map The map containing the RLE chunk.
* @param[in] start The starting index of the RLE chunk.
* @param[in] offset The offset in m_data of the RLE chunk.
* @return a value between [0, SM_CHUNK_RLE_MAX_CAPACITY] based on the
* position/existence of the next chunk in the map.
*/ */
static size_t static size_t
__sm_chunk_rle_capacity_limit(sparsemap_t *map, __sm_idx_t start, size_t offset) __sm_chunk_rle_capacity_limit(sparsemap_t *map, __sm_idx_t start, size_t offset)
@ -1931,7 +1941,9 @@ sparsemap_unset(sparsemap_t *map, sparsemap_idx_t idx)
} }
done:; done:;
if (offset != SPARSEMAP_IDX_MAX) {
__sm_coalesce_chunk(map, &chunk, offset, start, p); __sm_coalesce_chunk(map, &chunk, offset, start, p);
}
//__sm_when_diag({ fprintf(stdout, "\n++++++++++++++++++++++++++++++ unset: %lu\n%s\n", idx, QCC_showSparsemap(map, 0)); }); //__sm_when_diag({ fprintf(stdout, "\n++++++++++++++++++++++++++++++ unset: %lu\n%s\n", idx, QCC_showSparsemap(map, 0)); });
return ret_idx; return ret_idx;
} }