Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualParadigm Shifter

Posted 26 March 2013 - 07:20 PM

Well the solution is to mask out the bits you don't want before you do the shift... looks like your x, y are 8 bits and n is 16 bits so do

 

int32_t id = (n & 0xffff) | ((cell_x & 0xff) << 16) | ((cell_y & 0xff) << 24)

 

EDIT: Missed an effing eff


#1Paradigm Shifter

Posted 26 March 2013 - 07:13 PM

Well the solution is to mask out the bits you don't want before you do the shift... looks like your x, y are 8 bits and n is 16 bits so do

 

int32_t id = (n & 0xfff) | ((cell_x & 0xff) << 16) | ((cell_y & 0xff) << 24)


PARTNERS