Skip to content

Commit 270ddb7

Browse files
authored
Merge pull request #11 from bugparty/codex/update-cmakelists.txt-and-macros
Consolidate bounds check macro
2 parents 3473ef5 + 55ccfd2 commit 270ddb7

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.21)
22
project(bitvector)
33

44
set(CMAKE_CXX_STANDARD 17)
5-
option(BV_BOUNDS_CHECK "Enable bounds checking in bitvector" OFF)
6-
if(NOT BV_BOUNDS_CHECK)
7-
add_compile_definitions(BITVECTOR_DISABLE_BOUNDS_CHECK)
5+
option(BITVECTOR_NO_BOUND_CHECK "Disable bounds checking in bitvector" OFF)
6+
if(BITVECTOR_NO_BOUND_CHECK)
7+
add_compile_definitions(BITVECTOR_NO_BOUND_CHECK)
88
endif()
99
if(MSVC)
1010
# Set compiler flags for all configurations
@@ -35,10 +35,6 @@ elseif(MSVC)
3535
endif()
3636

3737
# Optionally disable bounds checking in the bitvector implementation
38-
option(BITVECTOR_ENABLE_BOUND_CHECK "Enable bounds checking in bitvector" OFF)
39-
if(NOT BITVECTOR_ENABLE_BOUND_CHECK)
40-
add_compile_definitions(BITVECTOR_NO_BOUND_CHECK)
41-
endif()
4238

4339
# Enable testing
4440
enable_testing()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository provides a small bit vector implementation along with tests and
77
Bounds checking is enabled by default. To benchmark without checks, configure and build with:
88

99
```bash
10-
cmake -S . -B build -DBV_BOUNDS_CHECK=OFF -DCMAKE_BUILD_TYPE=Release
10+
cmake -S . -B build -DBITVECTOR_NO_BOUND_CHECK=ON -DCMAKE_BUILD_TYPE=Release
1111
cmake --build build --config Release
1212
./build/bitvector_benchmark
1313
```

0 commit comments

Comments
 (0)