138 votes
Accepted

Does storing plain text data take up less space than storing the equivalent message in binary?

Plaintext is binary. When you write an H to a hard drive, the write head doesn't carve two vertical lines and a horizontal line into the platter, it magnetically encodes the bits 010010001 into the ...
8bittree's user avatar
  • 5,656
76 votes
Accepted

How do you debug a binary format?

For ad-hoc checks, just use a standard hexdump and learn to eyeball it. If you want to tool up for a proper investigation, I usually write a separate decoder in something like Python - ideally this ...
Useless's user avatar
  • 12.6k
40 votes
Accepted

What are the complexities of a binary search?

The full term for this is "Time Complexity" and you'll want to use that if you are searching. This is a core concept in computer science. I am not going to attempt to explain it in detail ...
JimmyJames's user avatar
  • 27.3k
20 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

I find this a great fun thing to think about. Binary is not 1s and 0s in the way you talk about it. Imagine there is a quantity, I can tell you what quantity it is in many different ways: Nine in ...
TessellatingHeckler's user avatar
18 votes
Accepted

Optimize a git repo, containing large binary files

You can use git-lfs or similar tools (git-fat, git-annex, etc.). Those tools basically replace the binary files in your repo with small text file with hashes, and store the actual binary data in a non-...
kat0r's user avatar
  • 295
14 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

Does storing plain text data take up less space than storing the equivalent message in binary? No, never. Your computer already stores the plain text data in the equivalent binary representation. ...
Telastyn's user avatar
  • 109k
12 votes
Accepted

Binary data formats, how to make ensure you can read different format versions?

It seems to me that the simplest solution is to make your version header unambiguous and make sure that the old format can never look like it has a format header, you simply look for it. If it's not ...
JimmyJames's user avatar
  • 27.3k
10 votes

How do you debug a binary format?

The first step to doing this is that you need a way to find or define a grammar that describes structure of the data i.e. a schema. An example of this is a language feature of COBOL which is ...
JimmyJames's user avatar
  • 27.3k
9 votes

Binary data formats, how to make ensure you can read different format versions?

Your old format starts with an 8-byte "size" element (probably a 64-bit long). If that's the file size in bytes (what I guess), it most probably never exceeded 100 GByte, meaning 2^37. So, if you ...
Ralf Kleberhoff's user avatar
8 votes
Accepted

Why is the bitwise AND of 1 and any even number equal to 0?

First, looking at decimal In base 10, we can easily determine the parity of an integer (whether it is even or odd), by looking at the parity of the last digit: If a base 10 numbers ends in 0, 2, 4, 6,...
Alexander's user avatar
  • 4,884
8 votes

What are the complexities of a binary search?

The average time is smaller than the worst-case time, because the search can terminate early, but this manifests as a constant factor, and the runtime is in the same complexity class. Using a linear ...
Simon Richter's user avatar
7 votes
Accepted

Preferred way to put drawings into Git repo

For generic vector graphics, SVG is the way to go. For more specific uses, there are sometimes more specific languages available. For example, the OMG specifies a full XML representation for UML, so ...
Jörg W Mittag's user avatar
7 votes

Binary data formats, how to make ensure you can read different format versions?

The convention format version ID, everything else is good because it gives maximum flexibility for the format. In your case the version ID isn't right at the front but at a fixed offset. This slightly ...
amon's user avatar
  • 134k
7 votes
Accepted

In C++, how is signed integer stored?

In C++, how is signed integer stored? The C++ specification does not prescribe any particular storage representation for signed integers on the actual hardware level. An implementation is free to ...
Jörg W Mittag's user avatar
6 votes

What is a Relocatable Binary?

Relocation is related to linking and loading. Read Levine's book Linkers & Loaders for details. Long time ago (at the beginning of Unix, 1970s) the kernel loaded and started an executable by ...
Basile Starynkevitch's user avatar
6 votes

Different Number Base Systems

Computers use Binary Code. Binary is used to encode both instructions and data. This is because transistors store and manipulate binary very nicely. It turns out that with enough boolean operations,...
Erik Eidt's user avatar
  • 33.8k
6 votes

How do you debug a binary format?

ASN.1, Abstract Syntax Notation One, provides a way of specifying a binary format. DDT - Develop using sample data and unit tests. A textual dump can be helpful. If in XML you can collapse/expand ...
Joop Eggen's user avatar
  • 2,051
6 votes
Accepted

How to prove that given binary files are compiled from provided source code?

how can I be 100% sure that the given binary files are compiled from the given source code? The only way is to compile it yourself using the exact same environment that has been used to build the ...
mouviciel's user avatar
  • 15.5k
6 votes

What are the complexities of a binary search?

The data in this table is not telling you how long a search takes. Its telling you how the time and storage may scale with the amount of data being searched. Lets take a real world example. Suppose ...
Stilez's user avatar
  • 507
5 votes

Best method for Pattern Matching on Binary String?

Reformulated problem statement You have some huge binary content and you'll have to scan it for a set of thousands of bit patterns. The main problem is that the bit patterns can happen anywhere in ...
Christophe's user avatar
  • 77.2k
5 votes
Accepted

How would a computer represent a negative base ten number in bits?

The 2's complement way to express -6886707 using 24 bits is, acording to: 100101101110101011001101 <- you 100101101110101011001101 <- exploringbinary.com ‭...
candied_orange's user avatar
5 votes
Accepted

Why directly edit binary files?

Why directly edit binary files? Same reason climbers climb mountains. Because you can. <Rant about the name "Binary File"> Anytime you edit any kind of computer file you ARE editing a ...
candied_orange's user avatar
5 votes

Do decimal equivalents to binary number values hold significance in software programming?

My question is: Is there any significance to the fact that the number we had to use to set that bit happens to be 64? There is exactly the same significance to the fact that the ascii character we ...
candied_orange's user avatar
5 votes

Why is the bitwise AND of 1 and any even number equal to 0?

To see why, let's start by finishing the AND operation and viewing the results in binary: 00101 (5) 00001 (1) -----& 00001 (1) 00100 (4) 00001 (1) -----& 00000 (0) When we AND a variable (...
Erik Eidt's user avatar
  • 33.8k
4 votes

What separates text files from binary files, considering they are stored in binary?

Obviously every file is binary when it comes down to it, since every file is stored as bytes and bits. But colloquially, binary file just means any file which is not a text file. And text file means a ...
JacquesB's user avatar
  • 59.6k
4 votes
Accepted

Understanding physical address

What Low Level Programming of the Raspberry Pi in C actually says is: So the BCM2708_PERI_BASE macro contains the physical adress value at which the peripheral registers start. This is the adress we ...
candied_orange's user avatar
4 votes

How are floating point representations (say single precision for instance) able to represent more numbers than what a 32 bit memory allows?

How are floating point representations (say single precision for instance) able to represent more numbers than what a 32 bit memory allows? They're not able to, and they don't. There are still only ...
Alexander's user avatar
  • 4,884
4 votes

How compiled code works?

There are a few pieces to the puzzle of executables. First, obviously, is the code itself. To understand this, you need to understand your target CPU's instruction set, including its binary encoding. ...
Sebastian Redl's user avatar
3 votes
Accepted

Shortening a boolean AND with third operand

There is only a minor simplification: a & b | (a | b) & carry This is equivalent to a & carry | (a | carry) & b and carry & b | (carry | b) & a
Frank Puffer's user avatar
  • 6,429
3 votes

Shortening a boolean AND with third operand

If you're counting by operations, and you're willing to count ?: as one operation, then you can improve on this answer with: carry ? (a|b) : (a&b) That is five operands and three operations. ...
ThePopMachine's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible