1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#pragma once template <typename T, unsigned short port> struct Port { static void out(T val, unsigned short offset = 0) { outb(val, port + offset); } static auto in(unsigned short offset = 0) { return inb(port + offset); } };