forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

shift and bitwise comparison

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Thu Aug 25, 2005 11:09 pm    Post subject: shift and bitwise comparison Reply with quote

how can i implement
Quote:
op1 | op2 Bitwise OR if both operands are numbers;
conditional OR if both operands are boolean

in lua? seems that this is not implemented as default

further i'm missing the shift
Quote:
op1 << op2 Shift bits of op1 left by distance op2; fills with zero bits on the right-hand side


shift could be possible solved by *2 and div2 thats right?
any ideas?
Back to top
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Aug 26, 2005 12:19 am    Post subject: Reply with quote

Lua has no binary relational operators, but looks like it could be useful for some low-level calculations, so I've added the "Bitwise operators and hexadecimal support" patch from http://lua-users.org/wiki/LuaPowerPatches and it will be available in the next release, maybe this weekend. Of course, shift operators need no patch, because x << y == x * math.pow(2, y) and x >> y == math.floor(x / math.pow(2, y)).
Back to top
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Fri Aug 26, 2005 12:24 am    Post subject: Reply with quote

great thanks
Back to top
View user's profile Send private message Visit poster's website
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Fri Aug 26, 2005 12:38 am    Post subject: Reply with quote

Shine wrote:
Lua has no binary relational operators, but looks like it could be useful for some low-level calculations, so I've added the "Bitwise operators and hexadecimal support" patch from http://lua-users.org/wiki/LuaPowerPatches and it will be available in the next release, maybe this weekend. Of course, shift operators need no patch, because x << y == x * math.pow(2, y) and x >> y == math.floor(x / math.pow(2, y)).


Cool! That would solve most of my lua p-sprint problems at the same time.
Back to top
View user's profile Send private message
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Fri Aug 26, 2005 4:31 am    Post subject: Reply with quote

Hmm... That hexadesimal stuff might be useful for my textreader ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group