|
-
Mar 26th, 2004, 12:23 PM
#1
Thread Starter
Lively Member
Help me convert this, its easy!!
hello all, I need to convert this code to VB6, could anybody please help me!
its this function:
Code:
#define BITS_PER_CHAR 8
unsigned short updcrc (unsigned short ch, unsigned short crc)
{
register short counter = BITS_PER_CHAR;
register short temp = crc
while (--counter >= 0)
if (temp & 0x8000){
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
temp ^= 0x1021;
}
else{
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
}
return (temp);
that calls this one:
Code:
#define BITS_PER_CHAR 8
unsigned short updcrc (unsigned short ch, unsigned short crc)
{
register short counter = BITS_PER_CHAR;
register short temp = crc
while (--counter >= 0)
if (temp & 0x8000){
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
temp ^= 0x1021;
}
else{
temp <<= 1;
temp += (((ch <<= 1) & 0x0100) != 0);
}
return (temp);
-
Mar 26th, 2004, 02:55 PM
#2
Addicted Member
convert its easy
Thats not easy I know some vb and i wouldnt know where to start. VB doesnt give u low level access to register variables or addresses. Thats why its harder than u think and VB sucks.
-
Mar 26th, 2004, 04:08 PM
#3
Not NoteMe
Perhaps if you described what they are doing people will be able to come up with a solution.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Mar 26th, 2004, 06:26 PM
#4
Frenzied Member
Its the crc check of smart tags for a SmartPass system. I dont think VB is going to let you do this. You are better off making this a DLL and linking it into your VB program.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 27th, 2004, 05:10 AM
#5
Fanatic Member
There's no problem doing this in VB, VB has bitwise AND, OR, XOR, and you can simulate bitshifting using multiplication or division. I'm feeling under the weather this morning, if this isn't resolved I'll do some code later.
-
Mar 27th, 2004, 07:35 AM
#6
It's possible, but CRC checks are supposed to be very fast, and that's something VB isn't good at, esp. if you emulate the shifts.
The DLL is the best approach.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 27th, 2004, 01:35 PM
#7
Frenzied Member
Originally posted by SLH
Perhaps if you described what they are doing people will be able to come up with a solution.
i think if he could describe what's going on he would be able to convert it to vb himseld
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|