## 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.

## Convert 8bit binary number to BCD in VHDL

The comments were getting too long. Consider the following block diagram: This represents an unrolled loop (for i in 0 to 7 loop) and shows that no add +3 occurs before i = 2 for the LS BCD digit and no add +3 occurs before i = 5 for the middle BCD digit, and no … Read more

## 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

## Tool for comparing 2 binary files in Windows [closed]

If you want to find out only whether or not the files are identical, you can use the Windows fc command in binary mode: fc.exe /b file1 file2 For details, see the reference for fc

## 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

## What is “two’s complement”?

Two’s complement is a clever way of storing integers so that common math problems are very simple to implement. To understand, you have to think of the numbers in binary. It basically says, for zero, use all 0’s. for positive integers, start counting up, with a maximum of 2(number of bits – 1)-1. for negative … Read more

## How to detect type of compression used on the file? (if no file extension is specified)

You can determine that it is likely to be one of those formats by looking at the first few bytes. You should then test to see if it really is one of those, using an integrity check from the associated utility for that format, or by actually proceeding to decompress. You can find the header … Read more

## Tools to help reverse engineer binary file formats

Here are some tips that come to mind: From my experience, interactive scripting languages (I use Python) can be a great help. You can write a simple framework to deal with binary streams and some simple algorithms. Then you can write scripts that will take your binary and check various things. For example: Do some … 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