Skip to content

Commit

Permalink
core: add unlikely macros for RTC ticking
Browse files Browse the repository at this point in the history
Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
  • Loading branch information
deltabeard committed Dec 23, 2023
1 parent 2a41bdc commit b866703
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions peanut_gb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3269,12 +3269,12 @@ void __gb_step_cpu(struct gb_s *gb)
if(gb->mbc == 3 && (gb->rtc_real.reg.high & 0x40) == 0)
{
gb->counter.rtc_count += inst_cycles;
while(gb->counter.rtc_count >= RTC_CYCLES)
while(PGB_UNLIKELY(gb->counter.rtc_count >= RTC_CYCLES))
{
gb->counter.rtc_count -= RTC_CYCLES;

/* Detect invalid rollover. */
if(gb->rtc_real.reg.sec == 63)
if(PGB_UNLIKELY(gb->rtc_real.reg.sec == 63))
{
gb->rtc_real.reg.sec = 0;
continue;
Expand Down

0 comments on commit b866703

Please sign in to comment.