Questions tagged [byte]

A unit of information usually corresponding to 8 bits. This term is also most often used to indicate the smallest addressable unit of storage on a digital system.

A unit of information usually corresponding to 8 bits. This term is also most often used to indicate the smallest addressable unit of storage on a digital system.

These days, the term byte usually refers to a unit of information consisting of 8 . Historically, other sizes have been used as well. If one wants to stress the fixed size, the term octet can be used instead.

7028 questions
2
votes
0 answers

Adding and Subtracting of bytes in python

In any python, is there a package out there that helps with adding and subtracting of bytes or byte arrays. Kinda like how this site does binary subtraction and addition. http://www.csgnetwork.com/binaddsubcalc.html I want to try to use files as a…
Nice1013
  • 105
  • 2
  • 7
2
votes
5 answers

How do you combine two bytes in python?

Say you have b'\x04' and b'\x00' how can you combine them as b'\x0400'?
Stock Overvalued
  • 73
  • 1
  • 1
  • 5
2
votes
1 answer

C# byte vs int for short integer values

This question is related to the physical memory of a C# Program. As we know that, byte variable consumes 1 byte of memory and on the other hand an int (32-bit) variable consumes 4-bytes of memory. So, when we need variables with possibly smaller…
HN Learner
  • 494
  • 6
  • 19
2
votes
1 answer

Python print bytes without terminator

I am trying to print shell code with python but it adds a \x0a terminator. Is there a way to print without the terminator? # cat test.py print(b'\x41\x41\x41\x41') # python test.py |xxd -g1 0000000: 41 41 41 41 0a …
Nitro
  • 1,133
  • 3
  • 14
  • 34
2
votes
3 answers

How can an ArrayList of objects(ArrayLists) be converted to an array of bytes?

I currently have a java program that requires quick communication between the client and server. I have decided to use UDP, after trying out TCP and RMI, which both were too slow for my purposes. I have multiple ArrayLists that are stored in one…
Anonymous
  • 169
  • 12
2
votes
2 answers

Writing to a specific byte C#

Hey I write simple application which is that two players can chat with each other and basically play. My app can do different actions according of received data type. For example if player 1 sends message to player 2, application on player 2's…
bielu000
  • 1,027
  • 1
  • 12
  • 31
2
votes
0 answers

Determining max virtual address space

Given a system using a single-level page table, where each page table entry in the page table is 4 bytes in size. A virtual address on this system is of size 32 bits, with a 22-bit virtual page number and a 10-bit offset field. The page table…
user6269144
  • 218
  • 1
  • 10
2
votes
1 answer

Effienctly unpack mono12packed bitstring format with python

I have raw data from a camera, which is in the mono12packed format. This is an interlaced bit format, to store 2 12bit integers in 3 bytes to eliminate overhead. Explicitly the memory layout for each 3 bytes looks like this: Byte 1 = Pixel0 Bits…
Dschoni
  • 3,192
  • 3
  • 34
  • 61
2
votes
1 answer

Bytes in vector C++

I have the following struct that stores every byte of the added element in subsequent positions of the vector : struct StashVector { int size; // Size of each space int next; // Next empty space // Dynamically allocated array…
stoychos
  • 29
  • 1
  • 5
2
votes
1 answer

File.WriteAllBytes is creating a 0 byte file

I'm currently working on a puzzle game, and trying to make an auto update program. So the user can update their game without manually downloading the latest version. The version checking itself is working, however when I'm trying to download the…
Teddynieuws
  • 43
  • 1
  • 9
2
votes
1 answer

How to set a signed 24-bit integer in a DataView?

I found this, but it's for unsigned 24-bit integers: DataView.prototype.setUint24 = function(pos, val) { this.setUint16(pos, val >> 8); this.setUint8(pos+2, val & ~4294967040); // this "magic number" masks off the first 16 bits } Simply…
maximedupre
  • 3,597
  • 4
  • 24
  • 56
2
votes
1 answer

Correct way to filter a byte stream in Golang?

I want to filter the STDOUT from a command such that I only keep the first and last line of any contiguous block of \r terminated lines (to largely ignore progress indicators). Here's my attempt (orig code does more, this is a simplified version,…
sbs
  • 799
  • 2
  • 9
  • 17
2
votes
2 answers

BitConverter.ToInt16 giving "Destination array is not long enough"

I am trying to convert an array of bytes into an array of shorts like this: Public Sub mixFinal() Dim patch1Buffer(patch1.Length - 44) As Byte System.Array.Copy(patch1, 44, patch1Buffer, 0, patch1.Length - 44) Dim…
H3XXX
  • 584
  • 1
  • 8
  • 20
2
votes
2 answers

BigInteger(String) and BigInteger(byte[]) are not equal

I was expecting the two constructors in the BigInteger class, BigInteger(String) and BigInteger(byte[]), to behave similarly but they don't. Why are the two BigInteger not equal? How can I create a BigInteger from the byte array? String hex =…
assylias
  • 297,541
  • 71
  • 621
  • 741
2
votes
1 answer

TypeError: Can't convert 'bytes' object to str implicitly while working with sockets

So I'm trying to convert code from Python 2.7 to Python 3, and it seems as though something has changed. I'm trying to receive binary data over a socket and now it doesn't work. Here's my code. EDIT: I have added my send code. Also, I don't really…
ken596
  • 23
  • 1
  • 5
1 2 3
99
100