HackerTrans
TopNewTrendsCommentsPastAskShowJobs

npendleton

no profile record

Submissions

GitHub Git Mirror Down

github.com
1 points·by npendleton·há 2 anos·2 comments

comments

npendleton
·ano passado·discuss
Hah, great point!
npendleton
·ano passado·discuss
This is so cool!

Terrible nitpick, but this is actually 3 operations, not instructions. On x86 you get 4:

  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
npendleton
·ano passado·discuss
Whoa, it looks like my old patch is getting fixed up properly now! We might be getting this feature https://lore.kernel.org/git/20250501214057.371711-4-gitster@...
npendleton
·ano passado·discuss
I agree! Unfortunately the best information appears to be in the individual series datasheets, however I did find this page to be helpful: https://products.espressif.com/#/product-selector
npendleton
·há 2 anos·discuss
Update, it's back! 2024-04-11T18:02Z
npendleton
·há 2 anos·discuss
The GitHub mirror for git is currently 404'ing (2024-04-11T17:55Z). Here it is yesterday: https://web.archive.org/web/20240410011924/https://github.co...