Questions tagged [bit]

A bit is a single binary digit.

A bit refers to a single binary digit, the smallest possible amount of information. In print is usually represented as either 0 or 1, with many different representations in technology, like the presence or absence of an electric current or magnetic field.

Eight bits form a single , although historically the term has been used for other sizes as well.

3593 questions
1
vote
1 answer

How can I assign a bit datatype value to a variable?

I have a table like this: // mytable +---------+-------------+ | id | bitmap | +---------+-------------+ | int(11) | BIT(10) | +---------+-------------+ | 1 | 01111111000 | | 2 | 01111111111 | | 3 | 00000000001…
Martin AJ
  • 6,261
  • 8
  • 53
  • 111
1
vote
1 answer

Eigen: multiply a float matrix by a bool vector

I need to perform A*v in Eigen where v is a vector of size p with t ones in random positions and p-t zeros, for more details look this question. My first question is: there is any way to do it in Eigen? If you know how to do it, please answer this…
justHelloWorld
  • 6,478
  • 8
  • 58
  • 138
1
vote
0 answers

PHP PDO bit value returns string

I have a lot of tables which has bit fields. For ex: CREATE TABLE `users` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `email` VARCHAR(150) NULL DEFAULT NULL, `password` VARCHAR(32) NULL DEFAULT NULL, `name` VARCHAR(100) NULL…
ahmetertem
  • 242
  • 6
  • 14
1
vote
1 answer

Get n bits from binary string

Is there a better way to get bit[] from binary string e.g. Let say I want bits from index=3 up to length (len=5) BinaryString = 10011000000000010000111110000001 Expected Result = 11000 This is what I have so far. Method 1 public void…
Ben Isaac
  • 69
  • 1
  • 10
1
vote
2 answers

Arduino lock bits avrdude

I am interested in locking my sketch of arduino of atmega328 to make it undownloadable. Is there some way to enable lock bits by compiling the sketch into Hex and then uploading it with avrdude ? Thank you
George Alto
  • 11
  • 1
  • 2
1
vote
0 answers

how to find a minimal value of a 9-bit trinary number

I got the following question: A trinary computer uses trits instead of bits (a trit can have values 0, 1 or 2). A trinary computer has a 9-trit floating-point representation of a number. Trit 8, the MST (Most Significant Trit), is the sign trit (1…
xYaelx
  • 144
  • 1
  • 1
  • 11
1
vote
2 answers

How to get all possible permutations for 0 and 1 bits in JAVA

I need the output of permutation for bits of length 3 to be (the order doesn't matter as the initial combination of 0 and 1 is generated randomly): [0,0,0] [0,0,1] [0,1,0] [0,1,1] [1,0,0] [1,0,1] [1,1,0] [1,1,1] I have done but it seems that…
mina_mz
  • 59
  • 1
  • 7
1
vote
1 answer

How to get the Bit value by index from NSData Hex value in Objective C

I have a NSData of Hex <80140142 0073ffff ffff04ff> I can get the Byte value by index NSData *commandIDData = [mqttResponseData subdataWithRange:NSMakeRange(3,1)]; <42> // 66 How Can I get the Bit value by index? 0100 0010 e.g index[0]=0 …
Shuvo Joseph
  • 894
  • 1
  • 12
  • 21
1
vote
1 answer

How to Determine which bits to set/clear based on a computation

I have a variable: ushort statusRegister; This variable tracks the result of various computations by way of the setting or clearing of its individuals bits. The bits are defined as: Bit0 = carry Bit1 = overflow Bit2 = Zero Bit3 = Sign …
user6262035
1
vote
2 answers

Java, combining two integers to long results negative number

I am trying to combining two integers to a long in Java. Here is the code I am using: Long combinedValue = (long) a << 32 | b; When a = 0x03 and b = 0x1B56 ED23, I am able to get the expected value (combinedValue = 13343583523 in long). However,…
Allen
  • 53
  • 1
  • 8
1
vote
3 answers

Java prints 00010 as 8

having this issue with a decryption program I am writing in Java. Here is the code in question public static int int_to_int(int input) { int[] value_array = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, …
1
vote
0 answers

Perform OR/AND operation on Bits argument

I am tring to perform a BITOR on a argument that i am passing into a function. so i wrote the below code. Statement 'SET result = arg1 | arg2 ' isnt working. I tried few ways, however i wasnt able to achieve the right result. What do i need to…
Oggu
  • 323
  • 1
  • 6
  • 18
1
vote
2 answers

How to set 1 for all bits without knowing the length of column?

I have a bit column like this: // mytable +---------+------------+ | id | numb | +---------+------------+ | int(11) | bit(10) | +---------+------------+ | 1 | NULL | | 2 | NULL | +---------+------------+ Not…
stack
  • 10,280
  • 19
  • 65
  • 117
1
vote
2 answers

Register address - change bit value of the second bit (bit index = 1) to 1

i am having the following register address: 0x18040028. Since I am pretty new to that stuff, how am I supposed to access that register address, change that one bit and then write it back (all other entries should stay the same)? Do I need to write a…
rimes
  • 761
  • 1
  • 8
  • 25
1
vote
2 answers

bits and bytes and what form are them

I'm still confused about the bits and bytes although I've been searching through the internet. Is that one character of ASCII = 1 bytes = 8 bits? So 8 bits have 256 unique pattern that covered all the ASCII code, what form is it stored in our…
Newbie
  • 13
  • 2
1 2 3
99
100