Click here to Skip to main content
15,906,261 members
Home / Discussions / C#
   

C#

 
QuestionC++ Crc Method to C# Crc Method Pin
Programm3r16-Sep-08 20:56
Programm3r16-Sep-08 20:56 
AnswerRe: C++ Crc Method to C# Crc Method Pin
Guffa16-Sep-08 21:24
Guffa16-Sep-08 21:24 
QuestionRe: C++ Crc Method to C# Crc Method Pin
Programm3r16-Sep-08 21:40
Programm3r16-Sep-08 21:40 
AnswerRe: C++ Crc Method to C# Crc Method Pin
leppie16-Sep-08 21:48
leppie16-Sep-08 21:48 
QuestionRe: C++ Crc Method to C# Crc Method Pin
Programm3r16-Sep-08 21:52
Programm3r16-Sep-08 21:52 
AnswerRe: C++ Crc Method to C# Crc Method Pin
leppie16-Sep-08 22:09
leppie16-Sep-08 22:09 
GeneralRe: C++ Crc Method to C# Crc Method Pin
Programm3r16-Sep-08 22:16
Programm3r16-Sep-08 22:16 
AnswerRe: C++ Crc Method to C# Crc Method Pin
Guffa16-Sep-08 22:49
Guffa16-Sep-08 22:49 
You have changed the type from ushort to uint, I'm not sure that works properly.

Do you really want to use unsafe code and pointers? Why not just use a string?

The InitialCrc value isn't used in the method at all, so you should remove it.

ushort crc16(string buffer) {
   ushort crc = 0;
   foreach (char c in buffer) {
      crc = (crc >> 8) | (crc << 8);
      crc ^= (ushort)c;
      crc ^= (crc & 0xff) >> 4;
      crc ^= crc << 12;
      crc ^= (crc & 0xff) << 5;
   }
   return crc;
}


Despite everything, the person most likely to be fooling you next is yourself.

QuestionConnection String Problem using textBox1.text Pin
M Riaz Bashir16-Sep-08 20:51
M Riaz Bashir16-Sep-08 20:51 
AnswerRe: Connection String Problem using textBox1.text Pin
Giorgi Dalakishvili16-Sep-08 21:11
mentorGiorgi Dalakishvili16-Sep-08 21:11 
GeneralRe: Connection String Problem using textBox1.text Pin
Guffa16-Sep-08 21:14
Guffa16-Sep-08 21:14 
GeneralRe: Connection String Problem using textBox1.text Pin
Giorgi Dalakishvili16-Sep-08 21:17
mentorGiorgi Dalakishvili16-Sep-08 21:17 
AnswerRe: Connection String Problem using textBox1.text Pin
Programm3r16-Sep-08 21:12
Programm3r16-Sep-08 21:12 
AnswerRe: Connection String Problem using textBox1.text Pin
Guffa16-Sep-08 21:12
Guffa16-Sep-08 21:12 
GeneralRe: Connection String Problem using textBox1.text Pin
M Riaz Bashir16-Sep-08 21:16
M Riaz Bashir16-Sep-08 21:16 
GeneralRe: Connection String Problem using textBox1.text Pin
Guffa16-Sep-08 21:27
Guffa16-Sep-08 21:27 
GeneralRe: Connection String Problem using textBox1.text Pin
M Riaz Bashir16-Sep-08 21:29
M Riaz Bashir16-Sep-08 21:29 
AnswerRe: Connection String Problem using textBox1.text Pin
Programm3r16-Sep-08 21:26
Programm3r16-Sep-08 21:26 
GeneralRe: Connection String Problem using textBox1.text Pin
M Riaz Bashir16-Sep-08 21:28
M Riaz Bashir16-Sep-08 21:28 
AnswerRe: Connection String Problem using textBox1.text Pin
Giorgi Dalakishvili16-Sep-08 21:37
mentorGiorgi Dalakishvili16-Sep-08 21:37 
AnswerRe: Connection String Problem using textBox1.text Pin
Vasanth.S.R17-Sep-08 0:58
Vasanth.S.R17-Sep-08 0:58 
AnswerRe: Connection String Problem using textBox1.text Pin
Mohammed Hameed17-Sep-08 1:05
professionalMohammed Hameed17-Sep-08 1:05 
Questioni want to make the fix sized text in text box(e.g 10 characters). Pin
maifs16-Sep-08 20:51
maifs16-Sep-08 20:51 
AnswerRe: i want to make the fix sized text in text box(e.g 10 characters). Pin
Ajay.k_Singh16-Sep-08 21:24
Ajay.k_Singh16-Sep-08 21:24 
GeneralRe: i want to make the fix sized text in text box(e.g 10 characters). Pin
maifs16-Sep-08 21:50
maifs16-Sep-08 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.