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
1
vote
1 answer

Assembly. How to check for the number of zeros in word?

I have a task: Given the array of 7 bytes. Representing it as an array of 8 7-bit words, count the number of words with an odd number of zeros in them. Here's my code so far. I have a code sample with the check for the number of 1's oddity but can't…
awayneff
  • 11
  • 2
1
vote
3 answers

Is there a way to do a parity check using bit shifting, and without using xor of a string with bits?

#include #include int main(int argc, char *argv[]) { if (argc == 2) { int iParity = 0; int bitmask = 0; for (int i = 1; i < strlen(argv[1]); i++) { switch (argv[1][i]) { …
Genodan
  • 31
  • 3
1
vote
0 answers

How to add a parity bit to the input sequence VHDL

I am making a FSM Moore sequence detector on VHDL for a given input bit sequence (10100110) but now I also want to add an even parity bit to the input bit sequence as a new sequence. I know the logic behind it to use xor gate but im unable to…
gmomma10
  • 73
  • 4
1
vote
1 answer

Substrate - finalized is zero

2021-04-11 00:57:24 ✨ Imported #21 (0x5294…9b0d) 2021-04-11 00:57:25 Idle (0 peers), best: #21 (0x5294…9b0d), finalized #0 (0xd6bc…1466), ⬇ 0 ⬆ 0 2021-04-11 00:57:30 Starting consensus session on top of parent…
1
vote
0 answers

How to call Constants Declared in Metadata Of substrate Node

I am using this library https://github.com/centrifuge/go-substrate-rpc-client where we fetch Latest Metadata via this call in my gloang code api.RPC.State.GetMetadataLatest(). This will return me metaData result for the connected substrate node from…
1
vote
0 answers

Why does this integer parity optimization fail in GLSL?

I am using GLSL to draw axes with GL_LINES. It works, but the optimization below fails. Correct rendering: This is constructed from 6 lines, each starting at (0,0,0), are directed outwards, and have 2 attributes: flat int f_parity is 0 on the…
spraff
  • 32,570
  • 22
  • 121
  • 229
1
vote
1 answer

Uses of the AF, PF in modern asm

I've done some browsing and it seems like the PF and AF are very rarely used, and for a beginner such as myself, can basically be ignored as they rarely if ever will come up. From what I've found it seems the use-cases are: Binary-coded decimal for…
carl.hiass
  • 1,526
  • 1
  • 6
  • 26
1
vote
2 answers

Adding additional data fields to account information in Substrate

Very new to Substrate and Rust. My understanding of the ChainState is that it acts sort of like a database which holds account numbers (in this case public keys) and their associated balances. When making a transaction, Substrate basically checks to…
1
vote
1 answer

Get dynamic rows of matrix based on the ones of another matrix (Matlab)

I am new to Matlab and I need some help. I want compute Parity Check Matrix and then to encode a codeword using Generator Matrix My matrix is the following : 1 0 0 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 1 The codeword is 1 0 1 1. My code…
prokopis
  • 117
  • 11
1
vote
1 answer

How to decode and match a call when passed as a parameter in Substrate

I have a method that accepts a call (similar to the sudo or recovery pallets) and i want to run some validation on the call before i dispatch it. The validation is mainly around restricting which methods we can call via this method. Here is an…
Nahu
  • 143
  • 10
1
vote
1 answer

How to create a hash of an arbitrary data with Parity substrate

I would like to know how to create a hash of a string with substrate. I really don't get which files to include to get the thing working. I've followed this https://substrate.dev/docs/en/tutorials/creating-your-first-substrate-chain without success.
woss
  • 933
  • 1
  • 11
  • 20
1
vote
0 answers

Calculate LoRa message length with code rate

I'm looking for a formula, with that I can calculate the message length of my payload that is sent over the Lora modulation. Example: message length without parity bits: 8 bits, coding rate: 4/5 Is there a formula to calculate the message length…
1
vote
1 answer

Parity using "modulo"

I ran into this, while looking up algorithms that find parity, which is supposedly efficient: function usingModulo(v) { v ^= v >> 1 v ^= v >> 2 v = (v & 0x11111111) * 0x11111111 return (v >> 28) & 1 } Could some one please explain…
x70766c
  • 143
  • 7
1
vote
0 answers

ethereumjs-tx parameters for parity network

I am using ethereumjs-tx, example below is to the rospten test net: const EthereumTx = require('ethereumjs-tx').Transaction; const rawTx = { "from": sender, "nonce": "0x" + count.toString(16), "gasPrice":…
Alvin
  • 8,219
  • 25
  • 96
  • 177
1
vote
1 answer

Substrate: Error on inherent extrinsic submission from the polkadot.js UI

EDIT: the error goes away when I re-open the Polkadot app in a private Chromium window (ref). I am following the substratekitties substrate tutorial and want to play around with the storage. I have defined the following module that stores a counter…
little-dude
  • 1,544
  • 2
  • 17
  • 33