Skip to content

Commit 2a3cd09

Browse files
committed
Avoid using common words as macro names
1 parent f8b1b49 commit 2a3cd09

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/common.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,6 @@ extern "C" {
3030
"Please do not compile this with a lslboost version older than 1.45 because the library would otherwise not be protocol-compatible with builds using other versions."
3131
#endif
3232

33-
// size of a cache line
34-
#if defined(__s390__) || defined(__s390x__)
35-
#define CACHELINE_BYTES 256
36-
#elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
37-
#define CACHELINE_BYTES 128
38-
#else
39-
#define CACHELINE_BYTES 64
40-
#endif
41-
42-
// force-inline the given function, if possible
43-
#if defined(__clang__) || defined(__GNUC__)
44-
#define FORCEINLINE __attribute__((always_inline))
45-
#elif defined _MSC_VER
46-
#define FORCEINLINE __forceinline
47-
#else
48-
#define FORCEINLINE inline
49-
#endif
50-
5133
// compiler hint that the given expression is likely or unlikely
5234
// (e.g., in conditional statements)
5335
#if defined(__clang__) || defined(__GNUC__)

src/consumer_queue.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
#include <thread>
1010

1111
namespace lsl {
12+
13+
// size of a cache line
14+
#if defined(__s390__) || defined(__s390x__)
15+
constexpr int CACHELINE_BYTES = 256;
16+
#elif defined(powerpc) || defined(__powerpc__) || defined(__ppc__)
17+
constexpr int CACHELINE_BYTES = 128;
18+
#else
19+
constexpr int CACHELINE_BYTES = 64;
20+
#endif
21+
1222
/**
1323
* A thread-safe producer/consumer queue of unread samples.
1424
*
@@ -139,13 +149,13 @@ class consumer_queue {
139149
inline static void move_or_drop(sample_p &src, sample_p &dst) { dst = std::move(src); }
140150

141151
/// helper to add a delta to the given index and wrap correctly
142-
FORCEINLINE std::size_t add_wrap(std::size_t x, std::size_t delta) const {
152+
inline std::size_t add_wrap(std::size_t x, std::size_t delta) const noexcept {
143153
const std::size_t xp = x + delta;
144154
return xp >= wrap_at_ ? xp - wrap_at_ : xp;
145155
}
146156

147157
/// helper to increment the given index, wrapping it if necessary
148-
inline std::size_t add1_wrap(std::size_t x) const {
158+
inline std::size_t add1_wrap(std::size_t x) const noexcept {
149159
return ++x == wrap_at_ ? 0 : x;
150160
}
151161

0 commit comments

Comments
 (0)