Jump to content
IGNORED

Numbers larger than 255..


yuppicide

Recommended Posts

Is there a way to do this?

 

 a = a + 1
if a = 320 then 
if a = 321 then 
if a = 322 then 
if a = 323 then 
if a = 324 then 
if a = 325 then

 

.. or would I need two variables? Like this:

 

 a = a + 1
if a = 255 then b = 1
if b = 1 && a = 250 then
if b = 1 && a = 251 then
if b = 1 && a = 252 then
if b = 1 && a = 253 then
if b = 1 && a = 254 then
if b = 1 && a = 255 then

Edited by yuppicide
Link to comment
Share on other sites

Is there a way to do this?

 

 a = a + 1
if a = 320 then 
if a = 321 then 
if a = 322 then 
if a = 323 then 
if a = 324 then 
if a = 325 then

No, a byte can be only 0 to 255.

 

.. or would I need two variables? Like this:

 

 a = a + 1
if a = 255 then b = 1
if b = 1 && a = 250 then
if b = 1 && a = 251 then
if b = 1 && a = 252 then
if b = 1 && a = 253 then
if b = 1 && a = 254 then
if b = 1 && a = 255 then

Yes, you would need two bytes for any values between 256 and 65535. You *might* be able to simplify things by dimming two variables as an 8.8 fixed-point number, but it would depend on what you're trying to accomplish.

 

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...