Skip to content

Commit 48cee2f

Browse files
committed
fs: Use common to get branching helpers
1 parent 1962fd1 commit 48cee2f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/fs/memdisk.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
#include <fs/memdisk.hpp>
2323
#include <statman>
2424

25-
#define likely(x) __builtin_expect(!!(x), 1)
26-
#define unlikely(x) __builtin_expect(!!(x), 0)
27-
2825
extern "C" {
2926
char _DISK_START_;
3027
char _DISK_END_;
@@ -47,7 +44,7 @@ namespace fs {
4744

4845
auto sector_loc = image_start_ + blk * block_size();
4946
// Disallow reading memory past disk image
50-
if (unlikely(sector_loc >= image_end_))
47+
if (UNLIKELY(sector_loc >= image_end_))
5148
return buffer_t{};
5249

5350
auto buffer = new uint8_t[block_size()];
@@ -64,7 +61,7 @@ namespace fs {
6461
auto end_loc = start_loc + cnt * block_size();
6562

6663
// Disallow reading memory past disk image
67-
if (unlikely(end_loc >= image_end_))
64+
if (UNLIKELY(end_loc >= image_end_))
6865
return buffer_t{};
6966

7067
auto buffer = new uint8_t[cnt * block_size()];

0 commit comments

Comments
 (0)