Skip to content

Conversation

@ZERICO2005
Copy link
Contributor

The compiler will emit call pe, __setflag after signed comparisons. I have added our own faster implementation of __setflag to the CRT.

__setflag:
	ret	po
; __invertflag:
	push	af
	ex	(sp), hl
	ld	a, l
	xor	a, $80	; invert S flag
	ld	l, a
	ex	(sp), hl
	pop	af
	ret

Since the compiler only appears to emit call pe, __setflag instead of call __setflag, it might be better to have it call __invertflag so it can skip ret po

@mateoconlechuga
Copy link
Member

This seems sort of risky to me

@ZERICO2005 ZERICO2005 changed the title Optimized __setflag, removed float64_to_int.c Optimized __setflag May 15, 2025
@mateoconlechuga mateoconlechuga merged commit 570f85d into master May 23, 2025
9 checks passed
@mateoconlechuga mateoconlechuga deleted the opt_setflag branch May 23, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants