forked from b-dmitry1/e86r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalu.h
85 lines (83 loc) · 4.1 KB
/
alu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef ALU_H
#define ALU_H
void setpsz8(unsigned char value);
void setpsz16(unsigned short value);
void setpsz32(unsigned int value);
unsigned short signext8(unsigned char v);
unsigned int signext16(unsigned short v);
unsigned char add8(unsigned char a, unsigned char b, unsigned char c);
unsigned short add16(unsigned short a, unsigned short b, unsigned short c);
unsigned int add32(unsigned int a, unsigned int b, unsigned int c);
unsigned char sub8(unsigned char a, unsigned char b, unsigned char c);
unsigned short sub16(unsigned short a, unsigned short b, unsigned short c);
unsigned int sub32(unsigned int a, unsigned int b, unsigned int c);
unsigned char inc8(unsigned char a);
unsigned short inc16(unsigned short a);
unsigned int inc32(unsigned int a);
unsigned char dec8(unsigned char a);
unsigned short dec16(unsigned short a);
unsigned int dec32(unsigned int a);
unsigned char or8(unsigned char a, unsigned char b);
unsigned short or16(unsigned short a, unsigned short b);
unsigned int or32(unsigned int a, unsigned int b);
unsigned char and8(unsigned char a, unsigned char b);
unsigned short and16(unsigned short a, unsigned short b);
unsigned int and32(unsigned int a, unsigned int b);
void test8(unsigned char a, unsigned char b);
void test16(unsigned short a, unsigned short b);
void test32(unsigned int a, unsigned int b);
unsigned char xor8(unsigned char a, unsigned char b);
unsigned short xor16(unsigned short a, unsigned short b);
unsigned int xor32(unsigned int a, unsigned int b);
unsigned short imul8(char a, char b);
unsigned int imul16(short a, short b);
unsigned long long imul32(int a, int b);
unsigned short mul8(unsigned char a, unsigned char b);
unsigned int mul16(unsigned short a, unsigned short b);
unsigned long long mul32(unsigned int a, unsigned int b);
int idiv8(short a, char b, char *q, char *r);
int idiv16(int a, short b, short *q, short *r);
int idiv32(long long a, int b, int *q, int *r);
int div8(unsigned short a, unsigned char b, unsigned char *q, unsigned char *r);
int div16(unsigned int a, unsigned short b, unsigned short *q, unsigned short *r);
int div32(unsigned long long a, unsigned long long b, unsigned int *q, unsigned int *r);
unsigned short dshl16(unsigned short a, unsigned short b, unsigned short n);
unsigned int dshl32(unsigned int a, unsigned int b, unsigned int n);
unsigned short dshr16(unsigned short a, unsigned short b, unsigned short n);
unsigned int dshr32(unsigned int a, unsigned int b, unsigned int n);
unsigned char rol8(unsigned char v, unsigned char n);
unsigned short rol16(unsigned short v, unsigned char n);
unsigned int rol32(unsigned int v, unsigned char n);
unsigned char ror8(unsigned char v, unsigned char n);
unsigned short ror16(unsigned short v, unsigned char n);
unsigned int ror32(unsigned int v, unsigned char n);
unsigned char rcl8(unsigned char v, unsigned char n);
unsigned short rcl16(unsigned short v, unsigned char n);
unsigned int rcl32(unsigned int v, unsigned char n);
unsigned char rcr8(unsigned char v, unsigned char n);
unsigned short rcr16(unsigned short v, unsigned char n);
unsigned int rcr32(unsigned int v, unsigned char n);
unsigned char shl8(unsigned char v, unsigned char n);
unsigned short shl16(unsigned short v, unsigned char n);
unsigned int shl32(unsigned int v, unsigned char n);
unsigned char shr8(unsigned char v, unsigned char n);
unsigned short shr16(unsigned short v, unsigned char n);
unsigned int shr32(unsigned int v, unsigned char n);
unsigned char sar8(unsigned char v, unsigned char n);
unsigned short sar16(unsigned short v, unsigned char n);
unsigned int sar32(unsigned int v, unsigned char n);
unsigned short bswap16(unsigned short v);
unsigned int bswap32(unsigned int v);
void bts16(short n);
void bts32(int n);
void btr16(short n);
void btr32(int n);
void btc16(short n);
void btc32(int n);
void bt16(short n);
void bt32(int n);
unsigned short bsf16(unsigned short dst, unsigned short src);
unsigned int bsf32(unsigned int dst, unsigned int src);
unsigned short bsr16(unsigned short dst, unsigned short src);
unsigned int bsr32(unsigned int dst, unsigned int src);
#endif