Elektrine lite

← Feed

@gilesgoat@toot.wales

Post #2639705

2025-05-15 21:08 UTC

@ela@infosec.exchange This is INSANE .. I mean it's insane the C code written could not be worse than that !! .. But it's 10 times more insane the compiler realized what was meant to be and put the best solution ( i.e. 'mod 2' ) .. Did it guess by the NAME of the function the intended purpose maybe ??

Replies (2)

  • @gilesgoat@toot.wales @ela@infosec.exchange, it's not “i % 2”, as that would give an inverted result. It's either “~i & 1” or “1 & ~i”, depending on the output assembly code. Here it is, for 32-bit ARM: MOV r1, #1 BIC r0, r1, r0 BX lr (BIC is bit-clear, essentially AND NOT.)

    Open ##2639706

  • @ela@infosec.exchange 2025-05-16 06:06

    @gilesgoat@toot.wales No, that's purely by analysis.

    Open ##2639708