S
Skybuck Flying
Hello,
The objective of this contest is to set and clear a bit at an arbitrary
memory address as fast as possible.
Implement one or multiple prototypes to take part in the contest:
// 8 bit versions
// 1 in 256 bits
procedure SetBit_8bit( BaseAddress : pointer; BitIndex : byte );
function GetBit_8bit( BaseAddress : pointer; BitIndex : byte ) : boolean;
procedure ClearBit_8bit( BaseAddress : pointer; BitIndex : byte );
procedure XorBit_8bit( BaseAddress : pointer; BitIndex : int64 );
// 16 bit versions
// 1 in 2^16 bits
procedure SetBit_16bit( BaseAddress : pointer; BitIndex : word );
function GetBit_16bit( BaseAddress : pointer; BitIndex : word ) : boolean;
procedure ClearBit_16bit( BaseAddress : pointer; BitIndex : word );
procedure XorBit_16bit( BaseAddress : pointer; BitIndex : word );
// 32 bit versions
// 1 in 2^32 bits
procedure SetBit_32bit( BaseAddress : pointer; BitIndex : longword );
function GetBit_32bit( BaseAddress : pointer; BitIndex : longword ) :
boolean;
procedure ClearBit_32bit( BaseAddress : pointer; BitIndex : longword );
procedure XorBit_32bit( BaseAddress : pointer; BitIndex : longword );
// 64 bit versions
// 1 in 2^32 * 8 bits
procedure SetBit_64bit( BaseAddress : pointer; BitIndex : int64 );
function GetBit_64bit( BaseAddress : pointer; BitIndex : int64 ) : boolean;
procedure ClearBit_64bit( BaseAddress : pointer; BitIndex : int64 );
procedure XorBit_64bit( BaseAddress : pointer; BitIndex : int64 );
All implementations will be bug tested, examined, and performance tested.
Code can be in C, Delphi or Assembler.
Code should work on 286 and above.
( Hint: 286 code will run on 386,486,pentium, etc <- backwards compatible)
( Hint: Single 386 BTS instruction is slow )
( Hint: I already have a pretty fast 8 bit implementation )
Processor specific code is to be mentioned and still interesting.
Processor detection code is also interesting.
Results will be posted along the way.
Multiple entries/versions are allowed.
Final results will be posted as well.
Bye,
Skybuck.
The objective of this contest is to set and clear a bit at an arbitrary
memory address as fast as possible.
Implement one or multiple prototypes to take part in the contest:
// 8 bit versions
// 1 in 256 bits
procedure SetBit_8bit( BaseAddress : pointer; BitIndex : byte );
function GetBit_8bit( BaseAddress : pointer; BitIndex : byte ) : boolean;
procedure ClearBit_8bit( BaseAddress : pointer; BitIndex : byte );
procedure XorBit_8bit( BaseAddress : pointer; BitIndex : int64 );
// 16 bit versions
// 1 in 2^16 bits
procedure SetBit_16bit( BaseAddress : pointer; BitIndex : word );
function GetBit_16bit( BaseAddress : pointer; BitIndex : word ) : boolean;
procedure ClearBit_16bit( BaseAddress : pointer; BitIndex : word );
procedure XorBit_16bit( BaseAddress : pointer; BitIndex : word );
// 32 bit versions
// 1 in 2^32 bits
procedure SetBit_32bit( BaseAddress : pointer; BitIndex : longword );
function GetBit_32bit( BaseAddress : pointer; BitIndex : longword ) :
boolean;
procedure ClearBit_32bit( BaseAddress : pointer; BitIndex : longword );
procedure XorBit_32bit( BaseAddress : pointer; BitIndex : longword );
// 64 bit versions
// 1 in 2^32 * 8 bits
procedure SetBit_64bit( BaseAddress : pointer; BitIndex : int64 );
function GetBit_64bit( BaseAddress : pointer; BitIndex : int64 ) : boolean;
procedure ClearBit_64bit( BaseAddress : pointer; BitIndex : int64 );
procedure XorBit_64bit( BaseAddress : pointer; BitIndex : int64 );
All implementations will be bug tested, examined, and performance tested.
Code can be in C, Delphi or Assembler.
Code should work on 286 and above.
( Hint: 286 code will run on 386,486,pentium, etc <- backwards compatible)
( Hint: Single 386 BTS instruction is slow )
( Hint: I already have a pretty fast 8 bit implementation )
Processor specific code is to be mentioned and still interesting.
Processor detection code is also interesting.
Results will be posted along the way.
Multiple entries/versions are allowed.
Final results will be posted as well.
Bye,
Skybuck.