Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(2007) in .net
Message
From
02/03/2005 11:39:56
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
02/03/2005 09:37:22
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00991929
Message ID:
00992041
Views:
21
Its a long time I didn't do anything in C; what does the ^= operator do?

>Oscar,
>
>Here is C# implementation of SYS( 2007) function:
>
public static ushort Sys2007( string strExpr)
>{
>	ushort result = 0xFFFF;
>	byte[] bytes = System.Text.Encoding.Default.GetBytes( strExpr);
>	for( int curPos = 0; curPos < bytes.Length; curPos++)
>	{
>		result = (ushort)(( result << 8) + (byte)( result >> 8));
>		result ^= bytes[curPos];
>		result ^= (ushort)(( result >> 4) & 0x0F);
>		result ^= (ushort)(((byte)( result & 0xFF) ^ (result << 7)) << 5);
>	}
>	return result;
>}
>
HTH
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform