I mean this:
public int iPos
{
get { return oBits[oPos]; }
set { oBits[oPos]=( value<POS_MAX ? value : POS_MAX); }
}
oBits is a BitVector32 and oPos is BitVector32.Section - this code works slowly not because its a function call but because of BitVector itself - I already changed a few places in the past to deal with hex bitmasks directly - this code is likely to be inlined since its small, and performance gains were in region of 1000%.
The alternative code that you have written MAY be faster than bogstandard indexing of BitVector32, but it pays to bother calculate masks manually and use them as constants - sure pain in arse to maintain, but performance improvements are way too high to ignore.
public int iPos
{
get { return oBits[oPos]; }
set { oBits[oPos]=( value<POS_MAX ? value : POS_MAX); }
}
oBits is a BitVector32 and oPos is BitVector32.Section - this code works slowly not because its a function call but because of BitVector itself - I already changed a few places in the past to deal with hex bitmasks directly - this code is likely to be inlined since its small, and performance gains were in region of 1000%.
The alternative code that you have written MAY be faster than bogstandard indexing of BitVector32, but it pays to bother calculate masks manually and use them as constants - sure pain in arse to maintain, but performance improvements are way too high to ignore.
Comment