OpenCores
URL https://opencores.org/ocsvn/z3/z3/trunk

Subversion Repositories z3

[/] [z3/] [trunk/] [utils/] [16bitcolor.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 charcole
#include <stdio.h>
2
 
3
unsigned short ToU16(unsigned long a)
4
{
5
  unsigned short out=(a>>8)&0xF800;
6
  out|=(a>>5)&0x07E0;
7
  out|=(a>>3)&0x001F;
8
  return out;
9
}
10
 
11
int main(int argc, char **argv)
12
{
13
        int c;
14
        if (argc!=2)
15
        {
16
                printf("Usage: 16bitcolor hexcolor\n");
17
                return 1;
18
        }
19
        sscanf(argv[1], "%x", &c);
20
        printf("0x%06x->0x%04x\n", c, ToU16(c));
21
        return 0;
22
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.