Computer Chess Club Archives


Search

Terms

Messages

Subject: Quick bit extraction question

Author: Andrew Wagner

Date: 05:19:25 07/20/04


Being the great genius that I am, it dawned on me the other day that creating a
custom class to handle things like moves, which can be stored easily in
integers, was not terribly efficient. So, let's say, for example, I'm storing
the 'to' square for a move in the right-most (least-significant) 7 bits of an
integer, the 'from' square in the next 7 least significant bits, and possibly
other information in other (more significant) bits. What's the most efficient
way to knock off extra, more significant bits? I want to do something like this:
to = move MOD 128;
from = (move>>7) MOD 128;

...but not sure if that's most efficient. Thanks! Andrew



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.