sort? Programming Software Development by nope3d …gt;ms.getNumberOfElements()) { bitSize = this.getNumberOfElements(); } else { bitSize = ms.getNumberOfElements(); } } bitString = new int[bitSize]; if(!this.isEmpty()||!ms.isEmpty()) { boolean found… Re: Perl: need help converting to signed int Programming Software Development by d5e5 …, I'm using two's compliment 0xFFFFFFFF (stored in binary bitstring) should be -1, but it is showing up as 4294967295… in something like the following way? 0xFFFFFFFF (stored in binary bitstring) would be a string of 32 1's, right?[CODE… 32; #String of 32 1's my $pl = pack 'l', $bitstring; #Create a packed long integer my ($num) = unpack 'l', $pl… Re: Adding 1 with 1 in binary Programming Software Development by Agentbob …. Calculate sum of carry and last (rightmost) bit of the BitString. If the sum equals to 2 then make lastBit=0… 2 for the second to the last bit of the BitString, and so on (namely for all bits from right to… algorithm i'm trying to replicate. Adding 1 to a bitString. Adding 1 with 1 in binary Programming Software Development by Agentbob … s < bit: oldbitstring = str(int('1'*(bit-s) + b)) bitstring = str(int('1'*(bit-s) + b) + 1) if int…(bitstring[-1]) == 2: oldbitstring = int(oldbitstring) - 1 print oldbitstring [/CODE] *note … Perl: need help converting to signed int Programming Software Development by blah32 I'm trying to convert a bitstring to a signed 32 bit integer value. The bitstring is in big-endian. I can get… Re: Perl: need help converting to signed int Programming Software Development by d5e5 Please show us an example of a negative bitstring. I think that since you say "big-endian" …you have generated your bitstring according to the 2's Complement method but I'm… Re: Perl: need help converting to signed int Programming Software Development by blah32 yeah, I'm using two's compliment 0xFFFFFFFF (stored in binary bitstring) should be -1, but it is showing up as 4294967295 Huffman coding Programming Software Development by tiffany.leroux.7 … pass-by-reference string for the current // state of the bitstring. read the C++ documentation on 'string' to // see how to… Re: String to Bits Programming Software Development by Gribouillis …One such module is bitstring ([http://pypi.python.org/pypi/bitstring](http://pypi.python.org/pypi/bitstring)). Install it with easy_install…pip. Example: >>> from bitstring import BitString >>> bs = BitString(bytes="hello world") >&… [user manual is here](http://packages.python.org/bitstring/contents.html) Re: Binary File Facts Programming Software Development by Gribouillis …. Here is an example with python 2.7 from bitstring import BitString >>> s = BitString(bin='011101000110010101110011011101000010000001101111011001100000101001100001001000000110110101110101011011000111010001101001011011000110100101101110011001010000101001110011011101000111001001101001011011100110011100001010') >>> s… Re: working for a counter of 6 bit and i need a counter of 48 bit Programming Software Development by Gonbe … BIT_COUNT (6) void print_bits(int bitcount, char* bitstring, int offset) { if (bitcount == 0) …printf("%s\n", bitstring); } else { bitstring[offset] = '0'; print_bits(bitcount - 1, bitstring, offset + 1); bitstring[offset] = '1'; … Re: RC4 - key scheduling algorithm Hardware and Software Networking by Slavi … the user. 2) Hash/KDF the password into an n-bitstring. 3) Generate a n-bit randon number. 4) xor the… of the ciphertext are the random number. In here, n-bitstring and n-bit random number are with different size correct…? So it would be n-bitstring and m-bit random number, where the number is shorter… Re: sine, cosine problem Programming Software Development by Gribouillis … binary representation of floating points numbers using the module [i]bitstring[/i] available in pypi [code=python] >>> from… bitstring import BitString >>> bs = BitString(float=-0.5, length=64) >>>… Re: RC4 - key scheduling algorithm Hardware and Software Networking by Hiroshe … user. 2) Hash/KDF the password into an n-bitstring. 3) Generate a n-bit randon number. 4) …xor the number with the n-bitstring to get the key. 5) The first n-…user. 2) Hash/KDF the password into a n-bitstring. 3) Read the first n-bit's of …the ciphertext. 4) xor the n-bitstring with the first n-bits of the ciphertext. Here… Re: floating point arithmatic, WTF am I doing wrong? Programming Software Development by Gribouillis I have a starting point using module bitstring (from pypi) and the wikipedia page import bitstring test_data = [ ("0 01111 0000000000", 1…, c = (int(x, 2) for x in u.split()) s = bitstring.pack(fmt, a, b, c) print s.bin s, e… Re: Huffman coding writing large binary file Programming Software Development by Schol-R-LEA … >= 8) { bitCount = 0; bits.append(target); target = 0; } } } byte[] bitstring = new byte[bits.Length()]; for (int i = 0; i <… Re: Huffman coding writing large binary file Programming Software Development by tingwong …; bits.add(target); target = 0; } else { bits.add(target); } } byte[] bitstring = new byte[bits.size()]; for(int i = 0; i <… Re: Prime Number Generator (Python) Programming Software Development by joebob1st you may want to compare timings with (Generators) Speed up bitstring/bit operations in Python? [url]http://stackoverflow.com/questions/2897297/…speed-up-bitstring-bit-operations-in-python[/url] Fastest way to list all… Re: Signed and Unsigned int in python Programming Software Development by woooee … sign. There is [URL=http://pypi.python.org/pypi/bitstring/2.1.1]bitstring[/URL], [URL=http://pypi.python.org/pypi/BitBuffer… Re: Binary File Facts Programming Software Development by nouth from bitstring import Bits s = Bits(bin='001100010010011110100001101101110011') `s` returns `Bits('0x3127a1b73')` In the [docs](https://pythonhosted.org/bitstring/constbitarray.html) it has this example `>>> s3 = Bits(bin='0b001000110100')` But it has a `b` as the second char of the str?!?!? Re: Algorithmic challenge Programming Software Development by Gribouillis Yes it works, here is the code, using module bitstring from pypi #!/usr/bin/env python # -*-coding: utf8-*- '''find a …) import sys if sys.version_info < (3,): chr = unichr from bitstring import BitArray # sudo pip install bistring UMAX = 2 ** 16 a… Re: send raw data via serial Programming Software Development by bumsfeld Python has full set of binary operators, but I don't think there is one way to send bitstring to USB chip. Ultimately that is how data would travel in the serial wire. Re: Bit String help Programming Software Development by Duoas … (integer types). Hence, the number "10" is the bitstring 1010 (msb to lsb). For a number, the bits and… Re: Huffman algorithm implementation in C Programming Software Development by nilu28 … */ ch = fgetc (infile); if (feof (infile)) break; /* put the corresponding bitstring on outfile */ for (s=codes[ch]; *s; s++) bitout (outfile… Re: Huffman coding writing large binary file Programming Software Development by bguild … explain your problem. Why are you storing the bytes in `bitstring`? What use will they be after they have been written… Re: RC4 - key scheduling algorithm Hardware and Software Networking by Hiroshe … in the rest of the algorithm. > In here, n-bitstring and n-bit random number are with different size correct… Re: sort? Programming Software Development by masijade Well, where is your attempt at it? Re: Adding 1 with 1 in binary Programming Software Development by jrcagle So the idea is, you have two binary numbers represented as strings, and then you want to add them? I'm not seeing any obvious errors in the code above. Re: Adding 1 with 1 in binary Programming Software Development by Agentbob [QUOTE=jrcagle;455835]So the idea is, you have two binary numbers represented as strings, and then you want to add them? I'm not seeing any obvious errors in the code above.[/QUOTE] No, not exactly. What I"m trying to do is two bit complement. So for example, I want to determine the two bit complement of 10 with 4 bits. 1010 … Re: Perl: need help converting to signed int Programming Software Development by d5e5 After posting the above I tried substituting 'l' for 'N' in your original script and it also printed -1 for me, so I guess the problem is you are running it on a different platform. I'm using Ubuntu 10.04.3 LTS and my computer is 32-bit.[CODE]#!/usr/bin/perl use strict; use warnings; print bin2dec('1' x 32); #Prints -1 sub bin2dec { …