/*
Copyright (C) 2006 - 2009 Evan Teran
                   eteran@alum.rit.edu

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef MODRM_20070530_H_
#define MODRM_20070530_H_

#include "edisassm_types.h"

class ModRM {
public:
	ModRM(uint8_t value) : m_Value(value) {}
	ModRM(const ModRM &other) : m_Value(other.m_Value) {}
	ModRM &operator=(const ModRM &rhs) { m_Value = rhs.m_Value; return *this;}
private:
	union {
		struct {
		uint8_t RM  : 3,
				Reg : 3,
				Mod : 2;
		} m_Bits;

		uint8_t m_Value;
	};
public:	
	uint8_t rm() const	{ return m_Bits.RM; }
	uint8_t reg() const	{ return m_Bits.Reg; }
	uint8_t mod() const	{ return m_Bits.Mod; }
};

#endif

