News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

translate C++ code to MASM32

Started by miaomiao, March 15, 2006, 09:51:35 AM

Previous topic - Next topic

miaomiao

hi all, I am not familiar with C++ code, And I had see some C++ codes to  transform a string to another.
Then how can I do in my MASM32 codes? I need your help, Thanks.

the following is the C++ codes





By the way: SRC is a DWORD
     

miaomiao

anyone can help or give me some advices? Thank you.

This code IS the BEST one for me that I cannot translate "int num1 = (int) (SRC & ((long) Math.Round(Math.Pow(2, (double) num6)))) "

zooba

Perhaps if you try and separate that line into each little step and explain what it is doing, you will be able to implement it in asm.

Also, think about what the result of it is and describe it in english. There's a pretty good chance there's one or two commands that will do exactly that, without the overhead of using C's libraries and floating point functions.

Cheers,

Zooba :U

miaomiao

Thank you zooba, I translated, and only this code I donnot know how to translate into MASM32 codes, "text4 = Strings.Right(text4, 1) + Strings.Left(text4, Strings.Len(text4) - 1);", anyone else can help me please ?

miaomiao

#4
The following is my translated codes, but it cannot work correctly, anyone else can tell me which codes are not correctly? Thank you.




dsouza123

The code
text4 = Strings.Right(text4, 1) + Strings.Left(text4, Strings.Len(text4) - 1);
is rotating text.  Last becomes first. Does it num8 times.

Example
12345678
81234567
78123456
67812345
56781234
45678123

With a buffer of twice the size of the string (not counting the terminating zero),
with the string right justified (padded with the number of spaces equal to original length placed first).
The last chararcter can be replace one character before the current start and the last replaced with a zero byte.

****ABCD0
***DABC00
**CDAB000
*BCDA0000
ABCD00000

So no shifting/copying the whole string each time.