History

Add builtins ffs, clz, ctz, clrsb, popcount, parity

Add new file lib/builtin.c Modify include/tccdefs.h, lib/Makefile to compile it. Update tests/tcctest.c to test it.

herman ten brugge committed 3 years ago

Commit dd691431 parent ea0c57e4 files · +193 −5Browse files

Showing the changes to include (1 of 4 files). Show all

Unified · Split

include/tccdefs.h+15−0
@@ -309,4 +309,19 @@ · 308 unmodified lines
309309 #undef __MAYBE_REDIR
310310 #undef __RENAME
311311
312+#if !defined _WIN32
313+ #define __BUILTIN_EXTERN(name,u) \
314+ int __builtin_##name(u int); \
315+ int __builtin_##name##l(u long); \
316+ int __builtin_##name##ll(u long long);
317+
318+ __BUILTIN_EXTERN(ffs,)
319+ __BUILTIN_EXTERN(clz, unsigned)
320+ __BUILTIN_EXTERN(ctz, unsigned)
321+ __BUILTIN_EXTERN(clrsb,)
322+ __BUILTIN_EXTERN(popcount, unsigned)
323+ __BUILTIN_EXTERN(parity, unsigned)
324+ #undef __BUILTIN_EXTERN
325+#endif
326+
312327 #endif /* ndef __TCC_PP__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t