Questions tagged [parity]

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

A parity bit, or check bit, is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

There are two variants of parity bits: even parity bit and odd parity bit. In case of even parity, the parity bit is set to 1, if the number of ones in a given set of bits (not including the parity bit) is odd, making the number of ones in the entire set of bits (including the parity bit) even. If the number of ones in a given set of bits is already even, it is set to a 0. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, keeping the number of ones in the entire set of bits (including the parity bit) odd. when the number of set bits is odd, then the odd parity bit is set to 0.[1]

236 questions
5
votes
1 answer

How to activate Substrate GRANDPA finalization?

I want to start a chain with Babe/Grandpa consensus. I'm able to start block production using Toolbox->RPC->author->insertKey() in UI. But I don't know how to start block finalization. I've tried setting grandpa keys the same way I sat babe keys in…
5
votes
5 answers

parity of set bits after xor of two numbers

I found an observation by testing in C++. Observation is , 1 ) If two numbers where both numbers have odd number of set bits in it then its XOR will have even number of set bits in it. 2 ) If two numbers where both numbers have even number of set…
Kavar Rushikesh
  • 143
  • 1
  • 10
5
votes
4 answers

Working inline assembly in C for bit parity?

I'm trying to compute the bit parity of a large number of uint64's. By bit parity I mean a function that accepts a uint64 and outputs 0 if the number of set bits is even, and 1 otherwise. Currently I'm using the following function (by @Troyseph,…
étale-cohomology
  • 2,098
  • 2
  • 28
  • 33
5
votes
4 answers

One instruction to clear PF (Parity Flag) -- get odd number of bits in result register

In x86 assembly, is it possible to clear the Parity Flag in one and only one instruction, working under any initial register configuration? This is equivalent to creating a result register with an odd number of bits, with any operation that sets…
5
votes
2 answers

Why is the big O runtime of 1D parity checking log(n)?

So I am reading some code from this website: http://www.geeksforgeeks.org/write-a-c-program-to-find-the-parity-of-an-unsigned-integer/ And it shows how to determine whether a number has even or odd parity. However, I don't understand why the runtime…
Kamal
  • 560
  • 1
  • 5
  • 14
5
votes
4 answers

How do you determine if there is even 1s in a number's binary representation using C?

There are already questions about counting how many 1s are there in a number, but this question is about judging whether there is even or odd number of 1s. Any loop or conditional (including switch) statements are not allowed. Also, division,…
Renfei Song
  • 2,941
  • 2
  • 25
  • 30
5
votes
6 answers

How can I calculate Longitudinal Redundancy Check (LRC)?

I've tried the example from wikipedia: http://en.wikipedia.org/wiki/Longitudinal_redundancy_check This is the code for lrc (C#): /// /// Longitudinal Redundancy Check (LRC) calculator for a byte array. /// ex) DATA (hex 6 bytes): 02 30 30…
Alexx Perez
  • 215
  • 2
  • 10
  • 19
4
votes
2 answers

Is there a reverse-incremental backup solution with built-in redundancy (e.g. par2)?

I'm setting a home server primarily for backup use. I have about 90GB of personal data that must be backed up in the most reliable manner, while still preserving disk space. I want to have full file history so I can go back to any file at any…
JDC
  • 89
  • 2
  • 5
4
votes
1 answer

Converting between AccountId32 and AccountId in Substrate

I have a requirement where i get passed in some bytes and i need to create an accountId from it in Substrate 2.0. Is there a way to convert between AccountId32 and ::AccountId in the runtime (FRAME) ? Or to create an…
Nahu
  • 143
  • 10
4
votes
5 answers

What is the fastest way for bit operations to calculate a parity?

My solution (for every bit of the input block, there is such a line): *parity ^= (((x[0] >> 30) & 0x00000001) * 0xc3e0d69f); All types are uint32. This line takes the second bit of the input x, shifts it to the LSB and sets all other bits to zero.…
vls
  • 243
  • 1
  • 3
  • 11
4
votes
5 answers

Check if a number is odd or even (mathematical parity)

For a one digit number, I want to know if it's odd or even (multiple of 2). For example, given 9, print that is an odd number. (i.e. check the mathematical parity, not the computing parity.) This is what I have: assume cs:cseg,ds:dseg,ss:sseg …
user3522262
  • 79
  • 1
  • 3
  • 8
4
votes
1 answer

Android communication with USB to Serial Device and controlTransfers

I have searched through numerous posts such as this one: Using Android to Communicate with a USB HID Device but i am still not getting how do you determine requestType in controlTransfer calls? public int controlTransfer (int requestType, int…
nexus
  • 41
  • 1
  • 2
4
votes
3 answers

how to convert a character to 7 bit even parity in php

I want to convert a Character to a 7 bit even parity. Can you please suggest me, how to implement this?
Nidhin Baby
  • 1,618
  • 4
  • 14
  • 16
3
votes
2 answers

Failed to load manifest for dependency

I am trying to import some primitives into pallet in substrate but when I execute cargo check I get this error: failed to load manifest for dependency 'name of primitives' Dex pallet:…
P.E
  • 101
  • 2
  • 8
3
votes
1 answer

What flavor of underlying EVM is Substrate Frontier using (the EVM-compatible client)?

I was able to successfully build my own Ethereum-compatible Substrate by basically following the Substrate Dev Frontier Workshop tutorial ( which uses SputnikVM as the underlying EVM engine, as per the Frontier Evm Documentation ). I am aware of the…
Andy B.
  • 181
  • 2
  • 9
1
2
3
15 16