Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:18
mvaShao Voon Wong2-Oct-05 18:18 
AnswerRe: Which database access tech to use? Pin
S Douglas2-Oct-05 23:53
professionalS Douglas2-Oct-05 23:53 
AnswerRe: Which database access tech to use? Pin
Nemanja Trifunovic2-Oct-05 9:56
Nemanja Trifunovic2-Oct-05 9:56 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:14
mvaShao Voon Wong2-Oct-05 18:14 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:17
mvaShao Voon Wong2-Oct-05 18:17 
AnswerRe: Which database access tech to use? Pin
Nemanja Trifunovic3-Oct-05 3:52
Nemanja Trifunovic3-Oct-05 3:52 
AnswerRe: Which database access tech to use? Pin
Anonymous2-Oct-05 21:01
Anonymous2-Oct-05 21:01 
Questionhave problem convert javascript to c Pin
ThinkingPrometheus2-Oct-05 3:08
ThinkingPrometheus2-Oct-05 3:08 
hiho@ll

i need to convert a simple javascript i've found which generates a checksum to C
because i want to use it in a c prog
btw. i want to use this exact checksum code, so trieing another checksum algorithm isn't an option

here is only one line of code where i think the problem occures
i'll post the whole code as a reply so you can test it if you want

javascript:
<br />
 c[r(i,3)]=(c[r(i,3)]-c[r(i+1,3)]-j)^(r(i,3)==1?j<<s[i]:j>>>s[i]);<br />

C:
<br />
 c[r(i,3.0)]=(c[r(i,3.0)]-c[r(i+1,3.0)]-j)^(r(i,3.0)==1?j<<s[i]:j>>s[i]);<br />


r is defined as this:
<br />
#define r(x,y) (long long int)(floor(((x)/(y)-floor((x)/(y)))*(y)+0.1))<br />


and for testing you can use c as the following array:
<br />
 long long int c[]={0x9E3779B9,0x9E3779B9,0xE6359A60};<br />


the problem is that i get wrong values within the C code
but the javascript code works

another problem was Visual Studio!!
i got complete different values for the whole code using visual studio
using the same code on Linux (i used cygwin) got me right values (for some part of the whole code)
don't know what the problem is/was but neither Visual Studio nor Linux got the one line described above work
i get wrong values

anybody knows the right conversion of the javascript code to C code?
thx@ll
AnswerRe: the code to convert: Pin
ThinkingPrometheus2-Oct-05 3:10
ThinkingPrometheus2-Oct-05 3:10 
QuestionHow to Start Pin
| Muhammad Waqas Butt |2-Oct-05 0:02
professional| Muhammad Waqas Butt |2-Oct-05 0:02 
Answerstart !? Pin
Ghasrfakhri2-Oct-05 2:13
Ghasrfakhri2-Oct-05 2:13 
GeneralRe: start !? Pin
Christian Graus2-Oct-05 2:49
protectorChristian Graus2-Oct-05 2:49 
GeneralRe: start !? Pin
Ghasrfakhri2-Oct-05 3:20
Ghasrfakhri2-Oct-05 3:20 
GeneralRe: start !? Pin
toxcct2-Oct-05 4:02
toxcct2-Oct-05 4:02 
GeneralRe: start !? Pin
Christian Graus3-Oct-05 20:19
protectorChristian Graus3-Oct-05 20:19 
QuestionRe: start !? Pin
David Crow3-Oct-05 3:04
David Crow3-Oct-05 3:04 
AnswerRe: start !? Pin
Ghasrfakhri3-Oct-05 5:28
Ghasrfakhri3-Oct-05 5:28 
AnswerRe: start !? Pin
Hamed Musavi3-Oct-05 17:00
Hamed Musavi3-Oct-05 17:00 
AnswerRe: How to Start Pin
Christian Graus2-Oct-05 2:51
protectorChristian Graus2-Oct-05 2:51 
AnswerRe: How to Start Pin
Hamed Musavi3-Oct-05 16:26
Hamed Musavi3-Oct-05 16:26 
QuestionAssignment of Type at Run-Time Pin
LiquidE_SA1-Oct-05 22:11
LiquidE_SA1-Oct-05 22:11 
AnswerRe: Assignment of Type at Run-Time Pin
Maximilien2-Oct-05 2:31
Maximilien2-Oct-05 2:31 
QuestionCString question Pin
benjnp1-Oct-05 21:54
benjnp1-Oct-05 21:54 
AnswerRe: CString question Pin
LiquidE_SA1-Oct-05 22:14
LiquidE_SA1-Oct-05 22:14 
AnswerRe: CString question Pin
AHawk1-Oct-05 22:50
AHawk1-Oct-05 22: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.