3 ms·
Also, Hacker's Delight and OpenBSD probably have clever solutions for these.
by tinglymintyfrsh 4y ago
Also, Hacker's Delight and OpenBSD probably have clever solutions for these.
- wahern 4y agoSurprisingly, OpenBSD does not have a library (neither a public API nor even just routines which are copied project-to-project as is common with OpenBSD utilities and daemons) to handle arithmetic overflow. The closest might be malloc/realloc extensions, like reallocarray, that handle common scenarios where arithmetic overflow is seen.