GitHub Git Mirror Down
github.com1 pointsby npendleton2 comments
is_leap_year_fast:
imul eax, edi, 1073750999
and eax, -1073614833
cmp eax, 126977
setb al
ret
On ARM you get a bit more due to instruction encoding: is_leap_year_fast:
ldr r1, .LCPI0_0
mul r0, r0, r1
ldr r1, .LCPI0_1
and r1, r0, r1
mov r0, #0
cmp r1, #126976
movwls r0, #1
bx lr
.LCPI0_0:
.long 1073750999
.LCPI0_1:
.long 3221352463
Compiler explorer reference: https://godbolt.org/z/7ajYqbT9z - uses a pure software interrupt and redirects to your ISR's, so you incur additional overhead for all interrupts in your system
- ships with a homegrown c stdlib, which has several functional/security bugs (ex: vscanf will overflow if you use format specifiers other than [l]i/u), and neglects to provide gcc attributes for arg checking for the printf family functions
- build system issues $(MAKE) calls in every folder you're building, which makes it terrifically slow (especially noticeable on incremental builds)
- architecture makes it difficult to write custom drivers without building them into the kernel (eg if you want to use the kernel as a module in your project)