473,326 Members | 2,127 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,326 software developers and data experts.

working with bits

Hi all
I have a task to test a checksum algrorithum. This requires changing a
string of 12 chr's to a stream of 96 bits and then manipulating these.
Currently I work in vb (vb2008). Would it be better for me to use another
language (say vc++) and build a DLL to do the bit manipulating or does
vb.net have some way of working with bits.

Stephen

Aug 16 '08 #1
2 1938
if the manipulation is easy to do there is a converter from decimal to
binary

Public Function DecToBin(ByVal DecVal As Double) As String
Dim a As Double
a = DecVal
For b = 1 To Int(Log(DecVal) / Log(2)) + 1
DecToBin = CDbl(a Mod 2) & DecToBin
a = CDbl(Int(a / 2))
Next b
End Function
"s gall" <s@none.co.nzwrote in message
news:2E**********************************@microsof t.com...
Hi all
I have a task to test a checksum algrorithum. This requires changing a
string of 12 chr's to a stream of 96 bits and then manipulating these.
Currently I work in vb (vb2008). Would it be better for me to use another
language (say vc++) and build a DLL to do the bit manipulating or does
vb.net have some way of working with bits.

Stephen
Aug 16 '08 #2
Hi Stephen,

VB supports the standard bitwise operations Or, And, Not and XOr as well as
bit shifting >for right shift, and << for left shift.
One thing to be aware of, there is no type character for byte, so for
constants you have to write CByte(&HFF) or similar.
You can get the string into an array of bytes like so:

Dim b(0 To 7) As Byte
For i As Int32 = 0 To 7
b(i) = CByte(Asc(keyString(i)) And &H80)
Next

"s gall" <s@none.co.nzwrote in message
news:2E**********************************@microsof t.com...
Hi all
I have a task to test a checksum algrorithum. This requires changing a
string of 12 chr's to a stream of 96 bits and then manipulating these.
Currently I work in vb (vb2008). Would it be better for me to use another
language (say vc++) and build a DLL to do the bit manipulating or does
vb.net have some way of working with bits.

Stephen
Aug 17 '08 #3

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

Similar topics

1
by: Scott David Daniels | last post by:
I've been working on a module to get at the bits of all numeric types (no, I haven't thought of how to solve the decimal data type that is coming). I've finally got the bits module to pass all of...
6
by: Aaron Broad | last post by:
I can't get STL sort to work for this little huffman encoding program i'm writing. I get a whole whack of errors eminating from the line that call sthe sort. They all look like the following...
2
by: VanBurg | last post by:
Hallo! I have to do the following tasks: 1) I need to read first 4 bytes from file 2) Get all 32 bits for editing 3) Change some bits and save its back to file For now i have to understand...
39
by: Frederick Gotham | last post by:
I have a general idea about how negative number systems work, but I'd appreciate some clarification if anyone would be willing to help me. Let's assume we're working with an 8-Bit signed integer,...
132
by: Frederick Gotham | last post by:
If we look at a programming language such as C++: When an updated Standard comes out, everyone adopts it and abandons the previous one. It seems though that things aren't so clear-cut in the C...
8
by: den 2005 | last post by:
Hi everybody, I am not sure where to put this in this forum. So, I posted this at several topics. I created a class library that has two public methods Encrypt() and Decrypt(). I reference this...
13
by: arnuld | last post by:
/* C++ Primer 4/e * section 3.2 - String Standard Library * exercise 3.10 * STATEMENT * write a programme to strip the punctation from the string. */ #include <iostream> #include...
10
by: Stephen.Schoenberger | last post by:
Hello, Sorry if this is not "exactly" a C topic but I thought this would be the best place to start. I need some guidance on working with bitmap images in ANSI C. I need to "read" in a bitmap...
7
by: Ja NE | last post by:
(as first - thank you for all your help several years ago, and second - please apologise me for my clumsy enlgish) so, preface: some users on my photo related site sometimes enter (link) giant...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.