473,394 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

converting bitarray to int64

I have a bitarray with values as {true,false,true,true}

I want to convert this bitarray to Int64. How can I do the same,

when I take
byte[] testbytes = new byte[bit1.Length];
bit1.CopyTo(testbytes, 0)

where bit1 is my bit array
I get everything as zero

When I take
bool[] testbytesbool = new bool[bit1.Length];
bit1.CopyTo(testbytesbool , 0)

I get true and false at proper places.However this is not geting
converted to in64.

How do I conver this to in64.

This is just an example as my bitarry is comprised of 200000 values.
therefore I want to convert it to int64.

Jan 15 '07 #1
4 3861
<vi***********@gmail.comha scritto nel messaggio
>I have a bitarray with values as {true,false,true,true}

I want to convert this bitarray to Int64. How can I do the same,

when I take
byte[] testbytes = new byte[bit1.Length];
bit1.CopyTo(testbytes, 0)

where bit1 is my bit array
I get everything as zero

When I take
bool[] testbytesbool = new bool[bit1.Length];
bit1.CopyTo(testbytesbool , 0)

I get true and false at proper places.However this is not geting
converted to in64.

How do I conver this to in64.
Use the BitConverter class :)

--
www.neodatatype.net
Jan 15 '07 #2
I am unable to use the same.

Can you give an example. to convert bool[] to in32 or int 64

Jan 16 '07 #3
Bool[] is in my opinion not a bitarray it is an array of booleans.

A bitaray could be {1,0,1,1} decimal value 11

Cor
<vi***********@gmail.comschreef in bericht
news:11*********************@s34g2000cwa.googlegro ups.com...
>I am unable to use the same.

Can you give an example. to convert bool[] to in32 or int 64

Jan 16 '07 #4
>I am unable to use the same.
>
Can you give an example. to convert bool[] to in32 or int 64

MSDN?
Jan 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ramzi Abboud | last post by:
I want to store a binary string in SqlServer from VB .NET through a stored procedure. I have been storing the binary data in a BitArray which I am not set on by any means. When I pass the...
8
by: Rick | last post by:
Hi, Does C have some handy functions to convert chars, ints and floats to bit arrays? I need to store that stuff binary so a few functions would be great. Converting chars and ints isn't...
7
by: Eric | last post by:
Hi All, I need to XOR two same-length Strings against each other. I'm assuming that, in order to do so, I'll need to convert each String to a BitArray. Thus, my question is this: is there an...
0
by: James | last post by:
Hi, I need to use an array of bitarray and being able to dinamically redim the bitarray and the array of bitarray. I need something like: structure stBarray public BA as bitarray()...
3
by: HKannen | last post by:
Hello Everybody, I wrote a little method that gets me an Int32 from a BitArray. This method looks like this: private Int32 GetIntVal( BitArray iArray ) { Byte lByteArr = new Byte; ...
4
by: Rainer Queck | last post by:
Hi NG I have some questions concerning BitArrays. Assumption : BitArray with 16 Bits Is it possible to "load" a BitArray with a UInt16 Value with out iterating it like: UInt16 Bits =...
7
by: Rick Williams | last post by:
I was so happy to find the BitArray class. Until I 'cut and pasted' the following sample code from Visual Studio's help: #using <mscorlib.dll> #using <system.dll> using namespace System;...
2
by: Phil Galey | last post by:
Is it possible to convert from a BitArray to its Base 10 counterpart? So if you have Dim x As New BitArray(New Integer() {1, 0, 1}) Then how can you get to 5 from x being 101?
2
by: semedao | last post by:
Hi , I try the BitArray class to make Xor on 2 byte arrays. The result was that when I Xor 1with 2 I get 3 which is correct then Xoring 3 with 1 give me 0 (zero) when it should give me 2 ! ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.