cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

pixel_ops.h (1691B)


      1static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g,
      2                                         unsigned int b)
      3{
      4    return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6);
      5}
      6
      7static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g,
      8                                          unsigned int b)
      9{
     10    return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3);
     11}
     12
     13static inline unsigned int rgb_to_pixel15bgr(unsigned int r, unsigned int g,
     14                                             unsigned int b)
     15{
     16    return ((b >> 3) << 10) | ((g >> 3) << 5) | (r >> 3);
     17}
     18
     19static inline unsigned int rgb_to_pixel16(unsigned int r, unsigned int g,
     20                                          unsigned int b)
     21{
     22    return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
     23}
     24
     25static inline unsigned int rgb_to_pixel16bgr(unsigned int r, unsigned int g,
     26                                             unsigned int b)
     27{
     28    return ((b >> 3) << 11) | ((g >> 2) << 5) | (r >> 3);
     29}
     30
     31static inline unsigned int rgb_to_pixel24(unsigned int r, unsigned int g,
     32                                          unsigned int b)
     33{
     34    return (r << 16) | (g << 8) | b;
     35}
     36
     37static inline unsigned int rgb_to_pixel24bgr(unsigned int r, unsigned int g,
     38                                             unsigned int b)
     39{
     40    return (b << 16) | (g << 8) | r;
     41}
     42
     43static inline unsigned int rgb_to_pixel32(unsigned int r, unsigned int g,
     44                                          unsigned int b)
     45{
     46    return (r << 16) | (g << 8) | b;
     47}
     48
     49static inline unsigned int rgb_to_pixel32bgr(unsigned int r, unsigned int g,
     50                                             unsigned int b)
     51{
     52    return (b << 16) | (g << 8) | r;
     53}