Operator bitwise right shift

Previous topic - Next topic

josemym2

Hello,
Is there a way to implement the bitwise (>>)? I need it because it is running code in c + + and Java, and I wanted to do GLbasic

This is my code:
Code (glbasic) Select

FUNCTION transform: coord[], offset[],trans_coord[]

//'            Transform 3d coordinates into 2d positions based on the size of the screen AND an a y offset
//'
//'        coord: 3 dimensional coordinate TO be transformed TO an isometric 2d coordinate: list of 3 integers [x,y,z]
//'        offset: 2 dimensional offset FOR the isometric coordinate: list of 2 integers [x,y]
//'        Returns trans_coord: a 2d isometric coordinate: list of 2 integers [x,y]
//'
//'        Note: A side effect FOR speed: isometric transform scales x AND y values TO 1.118 times their
//'        actual value AND the z scale coordinate stays AS 1: therefore all sprites need TO be drawn with this ratio.
//    'transformation coordinates that are returned
   DIMDATA trans_coord[],0,0
//    'calculate x coordinate
   trans_coord[0]=(coord[0]-coord[1])+offset[0]
//    'calculates y coordinate
   trans_coord[1]=((coord[0]+coord[1])>>1)-coord[2]+offset[1]
   //RETURN trans_coord[]
ENDFUNCTION


thanks

Quentin

functions ASL() and ASR()

josemym2


josemym2

but where is the best for compatibility with the c++ operator ">>"?


Quentin

you also can use the << operator directly using INLINE

Code (glbasic) Select

LOCAL a% = 2

INLINE
a = a << 3;
ENDINLINE

PRINT "a is now: " + a, 0, 0
SHOWSCREEN
KEYWAIT

Scott_AW

Inline is a wonderful thing.
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

josemym2

#6
Thanks a lot.