diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-04-08 06:05:21 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-04-08 06:05:32 -0400 |
| commit | de399537f2e3aa542e716ad50d301062152588f0 (patch) | |
| tree | d37ef84f593255ad590ef79a11cbf451daa49e9f /src/irc.c | |
| parent | 7bbd819c8d2acbcc800f33644571b8d683924bb9 (diff) | |
| download | fujinet-chat-de399537f2e3aa542e716ad50d301062152588f0.tar.gz | |
Rewrite guts of print_ping_time() in asm, banish C division and modulus operators. 7359 bytes free.
Diffstat (limited to 'src/irc.c')
| -rw-r--r-- | src/irc.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -119,8 +119,8 @@ static void do_priv_nick(void) { the compiled code smaller, but it grew by ~50 bytes. avoid. */ static void print_ping_time(char *p) { + extern void print_jif_sec(unsigned int j); static unsigned int now, pingtime; - static unsigned int sec, frac; now = read_rtclok(); pingtime = (unsigned int)a2uint(p); @@ -128,19 +128,10 @@ static void print_ping_time(char *p) { /* correct for rtclock rollover (every ~9 mins) */ if(now < pingtime) now |= 0x8000; - pingtime = now - pingtime; - - sec = pingtime / timers.hz; - frac = pingtime % timers.hz; - frac *= 100; - frac /= timers.hz; - scr_print_active("*** "); scr_print_active(msg_src); scr_print_active(" lag: "); - scr_act_printnum(sec); - scr_putc_active('.'); - scr_act_printnum(frac); + print_jif_sec(now - pingtime); scr_putc_active('s'); } @@ -791,7 +782,8 @@ static void hunt_screen(signed char dir) { s += dir; if(s < 0) s = MAX_SCREENS - 1; - s %= MAX_SCREENS; + if(s == MAX_SCREENS) + s = 0; } while(scr_status[s] == SCR_UNUSED); scr_display(s); |
