Questions tagged [binary]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
13
votes
7answers
2k views

A binary 3D model format for a game

I've recently started working on my own game engine and I have been thinking about creating my own model format. Since text usually takes a long time to load and process I decided to make a binary ...
5
votes
2answers
2k views

Represent integer as binary in C

To practice my C, I've written a small function in C to display an integer as an 8-bit binary number. Please let me know how to improve this function, and other C-style coding conventions. Thanks! <...
5
votes
1answer
66 views

Binary IO inspired by struct pack

About I'm writing a header-only template library for helping with binary IO. It is inspired by pack-d, which is in turn inspired by Python's struct module. I've only finished the output part and ...
4
votes
4answers
323 views

Convert Integer to Binary String

This code takes a user input number which is a positive integer, and outputs a string representation of the number in binary. For example, input 2 outputs ...
4
votes
1answer
53 views

Binary guess game in C++

This is a program in C++ that guesses a number given by the user. I have to do homework and there's my attempt to solve an exercise from the programming book. If you know what can be done better and ...
3
votes
2answers
160 views

How to simplify and optimize bitwise get/set operations on a large bit buffer in JavaScript?

tl;dr: How could you rewrite the buf_get and buf_set functions below to be most optimal? It took me a long time and a lot of ...
3
votes
1answer
78 views

Swapping Nibbles

I have small (<250 bytes) chunk of binary data, where I know that almost always, the first nibble is going to be zero 0. For example, in hex: ...
1
vote
3answers
171 views

Fractional binary number to decimal number

Write and test your own double abc (char * b) function in the program, taking in the form of a string the fractional binary number of the form "1101.101" and returning an equal decimal number (here 1 *...
1
vote
2answers
184 views

Binary tree pruning with BFS

Below the text of the exercise: We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1. Return the same tree where every subtree (of the ...
1
vote
1answer
89 views

Serializing object graph to proprietary binary file

I'm creating a class library to read/write .3di files which are binary files describing 3D models for a video game. This review is for the write/serialization process. I've mapped the different ...
1
vote
1answer
42 views

Converting decimal to binary in Assembly

The longest example program in my PicoBlaze Simulator in JavaScript is this decimal-to-binary converter: ...