Re: Bitshifting in Euphoria?

new topic     » goto parent     » topic index » view thread      » older message » newer message
ne1uno said...
Icy_Viking said...

Hello,

I am working on a re-write of my SFML2 wrapper in Euphoria. I came across this enumeration in SFML2.

typedef enum { sfNone = 0, /< No border / title bar (this flag and all others are mutually exclusive)
sfTitlebar = 1 << 0, /
< Title bar + fixed border
sfResize = 1 << 1, /< Titlebar + resizable border + maximize button
sfClose = 1 << 2, /
< Titlebar + close button
sfFullscreen = 1 << 3, /< Fullscreen mode (this flag and all others are mutually exclusive)
sfDefaultStyle = sfTitlebar | sfResize | sfClose /
< Default window style
} sfWindowStyle;

I'm wondering if in euphoria code I'd convert it using bit shifts.

 
public enum type sfWindowStyle 
 
    sfNone = 0, 
    sfTitlebar = 1 -- or would I do something like bit_shift(1 < 0) ?	 
end type 
 

Any help would be greatly appericated.

  --  sfClose        = 1 << 2, ///< Titlebar + close button 
  sfClose  = shift_bits(1, -2) -- 1 << 2 Titlebar + close button 
 

Thanks, but could you help just a bit more, like can you explain to why shift_bits(1,-2), I kinda get it, but a explanation would be nice. So would sfTitlebar be something like sfTitlebar = shift_bits(1,1) ?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu