Questions tagged [nibble]

A unit of information usually corresponding to 4 bits.

In computing, a nibble (occasionally nybble or nyble to match the spelling of ) is a four- aggregation of information.[Wikipedia]

Although less common than the , some computer architectures use the nibble as the primary unit of computation and information storage.

54 questions
1
vote
2 answers

Reading top nibble and bottom nibble in a byte

What's the correct way to handle two distinct values being stored in one byte of data. I have a byte that contains two nibbles each containing their own data. I want to read the top nibble and the bottom nibble into their own variables. 11110000 =…
Mark Tomlin
  • 8,593
  • 11
  • 57
  • 72
1
vote
1 answer

Trying to split byte in a byte array into two nibbles

I am given a byte array and i am trying to test if the first 4 bits of the first byte is equal to 4. If not return the error code 2. I have tried pulling out the byte from the array and splitting the hexadecimal value fo it but i am not quite sure…
Martin Lopez
  • 103
  • 1
  • 16
1
vote
1 answer

How to perform binary operations on a nibble/tetrad in php?

So, I have numeric values from 0 to 15, so I saved them in hex codes (0 to f). Now I have a string of data containing hex code values of my nibbles. Data looks like this: a0fc3d78270db962e4ba525cf3acd What is the accurate/elegant/fast way of…
Youstay Igo
  • 321
  • 2
  • 11
1
vote
0 answers

Nibble transposed when storing binary files

I have some code that populates some binary data into a ByteBuffer, and then writes it to the disk using a FileChannel. Everything works great, and when I use hexdump on the file, I expect to see bytes stored in little-endian byte order (because my…
skittish
  • 121
  • 10
1
vote
1 answer

Determining Poker Hand Strength via Bit Manipulation

I'm following this: Optimizing hand-evaluation algorithm for Poker-Monte-Carlo-Simulation My setup is similar -- an unsigned long to represent the board and the player's holding. All cards are bit flags, starting at 1 and ending at 2^51. For…
end1dream
  • 119
  • 2
  • 6
1
vote
1 answer

Assign a hex value to the low nibble of a byte

I am doing an integration and I have the following condition for a field: If the length of the data is odd, the low nibble of the last byte is assigned the value hex 'F'. This hex 'F' for padding ensures that a whole number of bytes are used for…
user2362462
  • 25
  • 1
  • 5
1
vote
1 answer

Fastest way to count bytes that contain a 4-bit value at any bit offset?

I have an algorithm to search an array that contains 64 bytes of values and I want to find a 4 bit value and see how many times it occurs in the array. For example, the first element in the array might be 10101010 and the 4 bit value is 1010 in…
Justin Case
  • 787
  • 2
  • 15
  • 30
1
vote
2 answers

Convert floating point values to hexadecimal

I'm struggling with a floating point to hex conversion in Lua. My application communicates with an old Akai S2000 sampler. The sampler codes two byte messages into four nibble values. The nibbles are in reverse order, hence the most significant…
pascalc
  • 49
  • 7
1
vote
0 answers

How should I work with arrays of nibbles/quarter-bytes?

I find myself needing to work with "arrays" of elements of size 1/2 , or 1/4 - i.e. "arrays" of nibbles or quarter-bytes, packed together within bytes (according to some endianness choice). I know the standard library has the (unfortunate?)…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
0 answers

SMPTE to MIDI Time Code (MTC)

I'm trying to convert SMPTE to MTC. I've been looking everywhere to get some information about MTC and got pretty far, except for this last one step. I'm not entirely sure how I should achieve this, since MTC makes use of high and low nibbles, with…
boortmans
  • 1,138
  • 2
  • 24
  • 40
1
vote
5 answers

Unable to extract nibbles out of a word

I am trying to extract 4-bits from a 16-bit binary string, i.e nibbles out of a word Can anyone tell me what is wrong with this program? #include #include #include #include using namespace std; int main() { …
Prats
  • 1,515
  • 6
  • 16
  • 30
0
votes
2 answers

Convert a 4 bit binary nibble as a string into its hex equivalent value as a string

I'm not sure what I'm doing wrong, but my print statement doesn't seem to be working. def nib(string): if string == '0000': return '0' if string == '0001': return '1' if string == '0010': return '2' if…
kora
  • 19
  • 4
0
votes
0 answers

FSLOUTPUTTYPE is not set

I am working on juptyter notebook in my VSCODE and when I try to run a command line in a cell as the following: !'directory of fsl software' -I 'path of the mask in the MNI space' -o 'path of output file -w 'path of transformation from MNI to…
0
votes
0 answers

What would be faster: Spliting a 64-bit word into 16 nibbles and entering them in S-Boxes or using an entire 64-bit word directly as an entry?

This question is related to cryptography, but I believe I'm asking in right place (not in Crypto Stackexchange). Kuznyechik block cipher splits a 64-bit word into 16 nibbles (4-bits) and use them as entries in its S-Boxes, each nibble is mixed with…
0
votes
3 answers

Custom 4 bit data type in C#

I want to create a custom data type which is 4 bits (nibble). One option is this - byte source = 0xAD; var hiNybble = (source & 0xF0) >> 4; //Left hand nybble = A var loNyblle = (source & 0x0F); //Right hand nybble = D However, I want to store…
Dave Henry
  • 31
  • 2