-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathshift.h
43 lines (36 loc) · 1.05 KB
/
shift.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
#ifndef SHIFT_H_
#define SHIFT_H_
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "instruction_defs.h"
#include "emulator_functions.h"
#include "modrm.h"
#include "io.h"
typedef struct
{
uint8_t result;
uint8_t carry;
} ShiftRes8;
typedef struct
{
uint32_t result;
uint8_t carry;
} ShiftRes32;
uint8_t rol8(uint8_t val, uint8_t n);
uint8_t ror8(uint8_t val, uint8_t n);
ShiftRes8 rcl8(uint8_t val, uint8_t n, uint8_t carry);
ShiftRes8 rcr8(uint8_t val, uint8_t n, uint8_t carry);
ShiftRes8 shl8(uint8_t val, uint8_t n);
ShiftRes8 shr8(uint8_t val, uint8_t n, uint8_t carry);
ShiftRes8 sar8(uint8_t val, uint8_t n, uint8_t carry);
uint32_t rol32(uint32_t val, uint8_t n);
uint32_t ror32(uint32_t val, uint8_t n);
ShiftRes32 rcl32(uint32_t val, uint8_t n, uint8_t carry);
ShiftRes32 rcr32(uint32_t val, uint8_t n, uint8_t carry);
ShiftRes32 shl32(uint32_t val, uint8_t n);
ShiftRes32 shr32(uint32_t val, uint8_t n, uint8_t carry);
ShiftRes32 sar32(uint32_t val, uint8_t n, uint8_t carry);
#endif