News for hackers. Stuff that matters.

npendleton

Re:A leap year check in three instructions on Friday May 16, 2025 @08:22AM (#44004560)
Hah, great point!
Re:A leap year check in three instructions on Friday May 16, 2025 @06:48AM (#44003801)
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
Re:Converting a Git repo from tabs to spaces (2016) on Friday May 02, 2025 @07:45PM (#43875632)
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@...
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
Re:GitHub Git Mirror Down on Thursday April 11, 2024 @02:02PM (#40005002)
Update, it's back! 2024-04-11T18:02Z
Re:GitHub Git Mirror Down on Thursday April 11, 2024 @01:56PM (#40004926)
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...
Re:Knit: Making a Better Make on Saturday April 08, 2023 @08:53AM (#35492710)
Might be worth a look at remake, it can help a ton when debugging complex Make setups: https://github.com/rocky/remake
Re:Profiling Newlib-Nano's Memcpy on Tuesday October 12, 2021 @09:12PM (#28847103)
Post author here, you're correct! thanks for spotting it, I'll fix it now.
Re:Cheap FPGA Development Boards on Saturday August 08, 2020 @09:00PM (#24096475)
Thanks Gregory, that's really good info! Appreciate you taking the time to reply (and for all your work on this software, too!).
A few bits of trivia for anyone considering NuttX:

  - 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)
Re:Reverse Engineering Instruments’ File Format on Friday June 15, 2018 @04:38PM (#17323347)
binwalk is a good tool to use for this, especially early analysis: https://github.com/ReFirmLabs/binwalk
Re:All You Need to Know About UML Diagrams on Monday April 30, 2018 @04:39PM (#16962090)
My favorite flavor, plantuml, available with a cheesy (but very convenient) cli wrapper via npm- https://www.npmjs.com/package/node-plantuml The --unicode mode is particularly delightful