Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bitlshift(0xff, 24) doesn't work for me!
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00954994
Message ID:
00955064
Views:
20
This message has been marked as the solution to the initial question of the thread.
Works in VFP7 and above, but VFP6 does yield "********".

For VFP6, you'll need to do something like this:
?transform(bitlshift(0xff,23)*2,"@0")
>Maybe I am wrong but after I ran the following code:
>
? TRANSFORM(-16777216,"@0")
>I got:
>**********
>not 0xFF000000
>
>Do you have any thoughts on that?
>
>Thanks,
>Ali
>
>>Sure it did. You're asking for 0xff to be shifted left 24 bits. If you look at the result (0xff000000) that is exactly what you got with the value of -16777216.
>>
>>
>>
>>>Hi Taylor,
>>>
>>>Thanks for the reply, but it did not work?
>>>
>>>
>>>>>Hi Everybody,
>>>>>
>>>>>I would like to shift a number between 0-255 to the left 24 times. When I do the following for example:
>>>>>
>>>>>
? bitlshift(0xff, 24)
>>>>>
>>>>>I should get: 4278190080
>>>>>
>>>>>However, I get the following number instead:
>>>>>-16777216
>>>>>
>>>>>How can I correct it?
>>>>>
>>>>>Thank you,
>>>>>Ali
>>>>
>>>>That is the correct answer. VFP uses signed numbers.
>>>>
>>>>? TRANSFORM(-16777216,"@0") && 0xff000000
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform