#include "IDT.h"

void IDTDescEntry::SetOffset(uint64_t offset) {
	offset0 = (uint16_t)(offset & 0x000000000000ffff);         // lower 16 bits -> offset0
	offset1 = (uint16_t)((offset & 0x00000000ffff0000) >> 16); // upper 16 bits -> offset1
	offset2 = (uint32_t)((offset & 0xffffffff00000000) >> 32); // upper 32 bits -> offset2
}

uint64_t IDTDescEntry::GetOffset() {
	uint64_t offset = 0;
	offset |= (uint64_t)offset0;
	offset |= (uint64_t)offset1 << 16;
	offset |= (uint64_t)offset2 << 32;
	return offset;
}