File tree Expand file tree Collapse file tree 8 files changed +785
-123
lines changed Expand file tree Collapse file tree 8 files changed +785
-123
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,113 @@ ___ez80_ffsi48:
128128 call __i48xor
129129 jp __i48popcnt
130130
131+ ;-------------------------------------------------------------------------------
132+
133+ section .text
134+
135+ public ___ez80_clrsbc
136+ ___ez80_clrsbc:
137+ ; unoptimized
138+ ld hl, 3
139+ add hl, sp
140+ ld a, (hl)
141+ rlca
142+ sbc hl, hl
143+ xor a, l
144+ rrca
145+ call __bctlz
146+ dec a
147+ ret
148+
149+ ;-------------------------------------------------------------------------------
150+
151+ section .text
152+
153+ public ___ez80_clrsbs
154+ ___ez80_clrsbs:
155+ ; unoptimized
156+ ld hl, 3
157+ add hl, sp
158+ ld hl, (hl)
159+ ld a, h
160+ rla
161+ call c, __snot
162+ call __sctlz
163+ dec a
164+ ret
165+
166+ ;-------------------------------------------------------------------------------
167+
168+ section .text
169+
170+ public ___ez80_clrsbi48
171+ ___ez80_clrsbi48:
172+ ; unoptimized
173+ ld hl, 8
174+ add hl, sp
175+ ld a, (hl)
176+ dec hl
177+ dec hl
178+ ld de, (hl)
179+ dec hl
180+ dec hl
181+ dec hl
182+ ld hl, (hl)
183+ rla
184+ call c, __i48not
185+ call __i48ctlz
186+ dec a
187+ ret
188+
189+ ;-------------------------------------------------------------------------------
190+
191+ section .text
192+
193+ public ___ez80_parityc
194+ ___ez80_parityc:
195+ xor a, a
196+ ld hl, 3
197+ add hl, sp
198+ or a, (hl)
199+ ld a, 0
200+ ret pe
201+ dec a
202+ ret
203+
204+ ;-------------------------------------------------------------------------------
205+
206+ section .text
207+
208+ public ___ez80_paritys
209+ ___ez80_paritys:
210+ ; unoptimized
211+ ld hl, 3
212+ add hl, sp
213+ ld hl, (hl)
214+ call __spopcnt
215+ rrca
216+ sbc a, a
217+ ret
218+
219+ ;-------------------------------------------------------------------------------
220+
221+ section .text
222+
223+ public ___ez80_parityi48
224+ ___ez80_parityi48:
225+ ; unoptimized
226+ ld hl, 6
227+ add hl, sp
228+ ld de, (hl)
229+ dec hl
230+ dec hl
231+ dec hl
232+ ld hl, (hl)
233+ call __i48popcnt
234+ rrca
235+ sbc a, a
236+ ret
237+
131238;-------------------------------------------------------------------------------
132239
133240 section .text
@@ -326,11 +433,14 @@ ___ez80_rotateright48:
326433
327434;-------------------------------------------------------------------------------
328435
436+ extern __snot
437+ extern __i48not
329438 extern __i48xor
330439 extern __i48cmpzero
331440 extern __i48sub_1
332441
333442 extern __bctlz
443+ extern __sctlz
334444 extern __i48ctlz
335445
336446 extern __bpopcnt
@@ -340,4 +450,4 @@ ___ez80_rotateright48:
340450 extern __ibitrev
341451 extern __i48bitrev
342452
343- extern __frameset0
453+ extern __i48bswap
Original file line number Diff line number Diff line change 22#define _EZ80_BUILTIN_H
33
44#include <cdefs.h>
5+ #include <stdbool.h>
56
67#ifdef __cplusplus
78extern "C" {
@@ -17,6 +18,14 @@ unsigned char __ez80_ffsc(unsigned char) __NOEXCEPT_CONST;
1718unsigned char __ez80_ffss (unsigned short ) __NOEXCEPT_CONST ;
1819unsigned char __ez80_ffsi48 (unsigned __int48 ) __NOEXCEPT_CONST ;
1920
21+ unsigned char __ez80_clrsbc (unsigned char ) __NOEXCEPT_CONST ;
22+ unsigned char __ez80_clrsbs (unsigned short ) __NOEXCEPT_CONST ;
23+ unsigned char __ez80_clrsbi48 (unsigned __int48 ) __NOEXCEPT_CONST ;
24+
25+ bool __ez80_parityc (unsigned char ) __NOEXCEPT_CONST ;
26+ bool __ez80_paritys (unsigned short ) __NOEXCEPT_CONST ;
27+ bool __ez80_parityi48 (unsigned __int48 ) __NOEXCEPT_CONST ;
28+
2029unsigned char __ez80_popcountc (unsigned char ) __NOEXCEPT_CONST ;
2130unsigned char __ez80_popcounts (unsigned short ) __NOEXCEPT_CONST ;
2231unsigned char __ez80_popcounti48 (unsigned __int48 ) __NOEXCEPT_CONST ;
Original file line number Diff line number Diff line change @@ -111,14 +111,19 @@ __builtin_ffsll(x)
111111
112112#define stdc_count_ones_uc (x ) \
113113__ez80_popcountc(x)
114+
114115#define stdc_count_ones_us (x ) \
115116__ez80_popcounts(x)
117+
116118#define stdc_count_ones_ui (x ) \
117119__builtin_popcount(x)
120+
118121#define stdc_count_ones_ul (x ) \
119122__builtin_popcountl(x)
123+
120124#define stdc_count_ones_ui48 (x ) \
121125__ez80_popcounti48(x)
126+
122127#define stdc_count_ones_ull (x ) \
123128__builtin_popcountll(x)
124129
@@ -140,6 +145,13 @@ __builtin_popcountll(x)
140145
141146
142147
148+
149+ //------------------------------------------------------------------------------
150+ // stdc_bit_ceil
151+ //------------------------------------------------------------------------------
152+
153+
154+
143155//------------------------------------------------------------------------------
144156// stdc_bit_floor
145157//------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments