File tree 2 files changed +4
-1
lines changed
2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ static uint16_t last_ram_page = 0;
89
89
static uint32_t last_lba_page = 0 ;
90
90
91
91
uint32_t get_ram_page_for (const uint32_t addr32 ) {
92
- const register uint32_t lba_page = addr32 / RAM_PAGE_SIZE ; // 4KB page idx
92
+ const register uint32_t lba_page = addr32 >> SHIFT_AS_DIV ; // page idx
93
93
if (last_lba_page == lba_page ) {
94
94
return last_ram_page ;
95
95
}
Original file line number Diff line number Diff line change 15
15
#ifdef SWAP_BLOCK_1k
16
16
#define RAM_PAGE_SIZE_KB 1ul
17
17
#define RAM_IN_PAGE_ADDR_MASK (0x000003FF)
18
+ #define SHIFT_AS_DIV 10
18
19
#endif
19
20
// --- select only one of 'em
20
21
#ifdef SWAP_BLOCK_2k
21
22
#define RAM_PAGE_SIZE_KB 2ul
22
23
#define RAM_IN_PAGE_ADDR_MASK (0x000007FF)
24
+ #define SHIFT_AS_DIV 11
23
25
#endif
24
26
// --- select only one of 'em
25
27
#ifdef SWAP_BLOCK_4k
26
28
#define RAM_PAGE_SIZE_KB 4ul
27
29
#define RAM_IN_PAGE_ADDR_MASK (0x00000FFF)
30
+ #define SHIFT_AS_DIV 12
28
31
#endif
29
32
// --- select only one of 'em ^
30
33
You can’t perform that action at this time.
0 commit comments