bit

Why is amount of bits always(?) a power of two?

We have 8-bit, 16-bit, 32-bit and 64-bit hardware architectures and operating systems. But not, say, 42-bit or 69-bit ones. Why? Is it something fundamental that makes 2^n bits a better choice, or is just about compatibility with existing systems? (It's obviously convenient that a 64-bit register can hold two 32-bit pointers, or that a ...

How can I use mysql bit from using DBIx

Hi, I am trying to access a mysql bit field in my catalyst app. Here is the table info: SQL: create table foo{ ... mybitField bit(1) NOT NULL default b'0' } My mapped table: ... mybitField { data_type => "BIT", default_value => "b'0'", is_nullable => 0, size => undef, } ... Now in my controller, I do a simple...

Why byte b = (byte) 0xFF is equals to integer -1?

Why byte b = (byte) 0xFF is equal to integer -1? Ex: int value = byte b = (byte) 0xFF; System.out.println(value); it will print -1? ...

Bytes to Binary in C

Hello, I'm trying to simply convert a byte received from fget into binary. I know the value of the first byte was 49 based on printing the value. I now need to convert this into its binary value. unsigned char byte = 49;// Read from file unsigned char mask = 1; // Bit mask unsigned char bits[8]; // Extract the bits for (int i = 0; ...

Bit/byte conversion

How many bits is a .NET string that's 10 characters in length? (.NET strings are UTF-16, right?) ...

One's complement instead of just a sum of bits

A question in my university homework is why use the one's complement instead of just the sum of bits in a TCP checksum. I can't find it in my book and Google isn't helping. Any chance someone can point me in the right direction? Thanks, Mike ...

Atomic bitfield operations on 80x86?

Does 80x86 have instructions for atomically testing and setting individual bits of a word? ...

C unsigned int array and bit shifts

If i have an array of short unsigned ints. Would shifting array[k+1] left by 8 bits, put 8 bits into the lower half of array[k+1]? Or do they simply drop off as they have gone outside of the allocated space for the element? ...

How to run java application bundled to .app on Mac OS X in 32 bit mode?

I have written a java application on win vista, it uses Bonjour and works fine. When I run it on Mac OS X 10.5.8 with all updates installed as a .jar file it runs perfectly too. But when I create a bundle using Jar Bundler it fails with "Uncaught exception in main method: java.lang.UnsatisfiedLinkError: /usr/lib/java/libjdns_sd.jnilib: ...

Converting C++ Bit Pattern to Java

I am converting a C++ program to Java and got completely stuck in the following method which blew my mind. Would you be kind enough to explain what this method is doing? long TSBCA::GetSignedValue(const NDataString &value) { static NDataString s; s = value; long multiplier(1); size_t len(s.Len()); ...

Converting UTF-8(or other 8-bit encoding) to 7 or fewer bits.

I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I go about doing thi...

force a bit field read to 32 bits

I am trying to perform a less-than-32bit read over the PCI bus to a VME-bridge chip (Tundra Universe II), which will then go onto the VME bus and picked up by the target. The target VME application only accepts D32 (a data width read of 32bits) and will ignore anything else. If I use bit field structure mapped over a VME window (nmap'd...

Python: obtain & manipulate (as integers) bit patterns of floats

In Python V.2.5.4, I have a float, and I'd like to obtain and manipulate (as an integer) the bit pattern of that float. For example, suppose I have x = 173.3125 In IEEE 754 format, x's bit pattern (in hexadecimal) is 432D5000 . How can I obtain & manipulate (e.g., perform bitwise operations) on that bit pattern? ...

How to determine architecture in platform neutral way?

I have a C++ app that uses wxWidgets. Certain parts of the app differ for 32 and 64 bit hosts. Currently I use sizeof(void *), but is there a better way that uses conditional compilation and is platform neutral? ...

Arbitrary bit-sized data type in C#

What is the best way of defining in C# a structure with, say, 6 bits of data? I can, of course, define 2 fields of int + short, but I wonder if there's a way of holding all the data in 1 filed. Regards, Yaakov ...

Image Applet Bit Depth

Hi all. May I know is it true that a java applet only supports 24 bits image? If a 48 bits image is loaded, it will be truncated to 24 bits? Thank you. ...

Howto Flip Removable Bit on USB Drive in C#?

How do I Flip the Removable Bit of my USB Pen Drive or HDD in C# like this Tool does? Thanks in advance! ...

C/C++ efficient bit array

hi. Can you recommend efficient/clean way to manipulate arbitrary length bit array? right now I am using regular int/char bitmask, but those are not very clean when array length is greater than datatype length. std vector<bool> is not available for me. thanks ...

How to get Xvfb to work on 32 bit color

Can anybody tell me how to get Xvfb to work on 32bit color? Vnc4server works fine for example, but didn't fit my purpose. > /etc/X11# Xvfb :1 -screen 0 1600x1200x24 error opening security policy file /etc/X11/xserver/SecurityPolicy (EE) XKB: Couldn't open rules file /usr/share/X11/xkb/rules/base Could not init font path element /usr/sha...

FFmpeg bitrate issue.

I'm dealing with a very big issue about bit rate , ffmpeg provide the -b option for the bit rate and for adjustment it provide -minrate and -maxrate, -bufsize but it don't work proper. If i'm giving 256kbps at -b option , when the trans-coding finishes , it provide the 380kbps. How can we achieve the constant bit rate using ffmpeg. If ...