Related to shifting bytes and byte manipulation. There are operators in most of the programming languages to shift bits which could be used to shift bytes.
Questions tagged [byte-shifting]
77 questions
0
votes
3 answers
Help with objective c - java byte shift
I am sending data between Java and iPhone/objC clients. The Java client has an established middleware component that I am using to test integration of the new client to the middleware.
I have a problem with all byte shift operations. The Java code…

Jim Geldermann
- 183
- 3
- 18
0
votes
1 answer
Binary operations to pack mutliple values
Ive been playing around with a Bluetooth module for sending over data. The data contains of 3 rotations (0-360) and 3 buttons states (bits (0 or 1)).
I tried mapping this into a string (ie: 360_52_265_010% : x_y_z_bbb% where % is a mark for ending a…

Nick Peelman
- 585
- 1
- 10
- 28
0
votes
1 answer
Assembly procedure to convert binary/hex to split octal
This is an assignment, I don't know where to start.
Assignment:
A byte can be represented using three octal digits. Bits 7 and 6 determines the left octal digit (which is never higher than 3); bits 5, 4 and 3 are the middle digit; and bits 2, 1 and…

GeekyDewd
- 321
- 1
- 2
- 18
0
votes
1 answer
how to cast doubles from char array
I am shifting in 3 chars from serial port every 3rd char is a double that i split up for the port, so now i need to put it back to gether.
(Value before sending = 0x3F3400 or 0.703125)
char[0] = 0x3F (msb)
char[1] = 0x34
char[2] = 0x00 …

doggy
- 75
- 1
- 8
0
votes
1 answer
Ror byte array with C#
is there a way to Ror an entire byte[] by a specific amount?
I've already done some research and found a solution to Rol a byte[] :
public static byte[] ROL_ByteArray(byte[] arr, int nShift)
{
//Performs bitwise circular shift of 'arr' by…

Dark Side
- 695
- 2
- 8
- 18
0
votes
0 answers
Extracting a sequence of bits from a binary string (or byte)
I have a whole bunch of hex strings (56 bits or 112 bits), which I need to extract different parts from, after converting to a binary string.
How I would normally do it is either substring the parts, or try my luck with bit shifting, but instead of…

Benny Mose
- 694
- 1
- 8
- 15
0
votes
1 answer
bit shifting signed integer
I am bit shifting a sign integer first byte is exponent next 4 are mantissa. This does not always seem to work I beleive it is due to calling it a char but when i make it a signed or unisgned char it still is not 100%. any ideas?
char…

sjohnson
- 69
- 2
- 13
-1
votes
2 answers
Shifting binary number in c++
For example I want to do:
I have 1 it is 00000001 in binary.
and when I shift like 1<<3 I'll take 8 it is 00001000.
So, I need that I take 00001111 after 1<<3.
I wish you understand if something wrong add unclear ask about it please.
I want to do…

Jasom Freckenberg
- 23
- 4
-1
votes
3 answers
How to convert 2 bytes into a signed short in C
I have 2 bytes that I need to convert to a signed short number. For example, I have separate bytes (0000 0001) and (0000 0002) in binary. How can I convert these to a signed short value?

Mehmet Berk Cetin
- 101
- 8
-1
votes
1 answer
c# endianness and structure
im trying to get some packet from microcontroller to c# program:
i defined a structure in both places. i calculate crc32 of (sizeof(packet)-4bytes) and place it in mydata_t.crc32 ...
struct mydata_t
{
public byte cmd;
public UInt32 param;
…

Hasan alattar
- 347
- 3
- 19
-1
votes
1 answer
How to find out how long an array has to be when being initialized?
Imagine i have an byte-array ids.
Later i want to store data in it this way:
ids[cz << 24 | cx << 16 | y << 8 | z << 4 | x]
cz, cx, y, y, z, x are int values in this case.
So how long does the array need to be when i create it?
I thought i would…

Fabian Schmidt
- 334
- 1
- 13
-1
votes
1 answer
Bit shifting in hexadecimal in visual studio and outputting through cout
I am currently trying to learn c++ by following a tutorial online. This tutorial is showing me how to make a program using SDL2 and I got lost on one of the tutorials involving bit shifting in hex. The lecturer is using the Eclipse IDE while I'm…
-1
votes
1 answer
Java byte array(with long value) conversion to long in c++
I am putting a long value in a byte array in my Java Code. This(byte array) will be transmitted to the native side code(C++).
In this C++ code, I have to reconstruct the long value sent from Java.
How can I access the byte array and all the bytes in…

Black Diamond
- 483
- 7
- 25
-2
votes
2 answers
How to swap first and last nibbles in given integer [32 bits]
Suppose :
No = 77
77 in binary [32 bits] : 0000 0000 0000 0000 0000 0000 0100 1101
I have to swap first and last nibble:
i.e : 1101 0000 0000 0000 0000 0000 0100 0000
I was doing something like this:
no << 32 | no >> 32
Then in…

Manvi Koul
- 15
- 4
-2
votes
1 answer
Shifting with floats
float a = 1.0 + ((float) (1 << 25))
float b = 1.0 + ((float) (1 << 26))
float c = 1.0 + ((float) (1 << 27))
What are the float values of a, b, and c after running this code? Explain why the bit layout of a, b, and c causes each value to be what it…

user15648820
- 15
- 2