How do I create binary patches?

Check out bsdiff and bspatch (website, manpage, paper, GitHub fork). To install this tool: Windows: Download and extract this package. You will also need a copy of bzip2.exe in PATH; download that from the “Binaries” link here. macOS: Install Homebrew and use it to install bsdiff. Linux: Use your package manager to install bsdiff.

How are negative numbers represented in 32-bit signed integer?

Most computers these days use two’s complement for signed integers, but it can vary by hardware architecture, programming language, or other platform-specific issues. For a two’s-complement representation, the most-significant (“leftmost”) bit is referred to as the sign bit, and it will be set for a negative integer and clear for a non-negative integer. However, it … Read more

Is the most significant decimal digits precision that can be converted to binary and back to decimal without loss of significance 6 or 7.225?

These are talking about two slightly different things. The 7.2251 digits is the precision with which a number can be stored internally. For one example, if you did a computation with a double precision number (so you were starting with something like 15 digits of precision), then rounded it to a single precision number, the … Read more

Include binary file with GNU ld linker script

You could try using objcopy to convert it to a normal object you can link in, and then reference its symbols in the linker script like you would do to a normal object. From the objcopy manual page: -B bfdarch –binary-architecture=bfdarch Useful when transforming a raw binary input file into an object file. In this … Read more

Which arithmetic operations are the same on unsigned and two’s complement signed numbers?

Addition, subtraction and multiplication are the same provided: Your inputs and outputs are the same size Your behaviour on overflow is wraparound modulo 2n Division is different. Many instruction sets offer multiplication operations where the output is larger than the input, again these are different for signed and unsigned. Furthermore if you are writing your … Read more