Changes

Jump to: navigation, search

General Setwise Operations

781 bytes added, 00:52, 18 January 2022
no edit summary
'''x86-mnemonics''' <br/>
[[x86]] has general purpose instruction instructions, [[BMI2]] general purpose instructions not affecting processor flags, as well as [[SIMD and SWAR Techniques|SIMD-instructions]] for various shifts:
<pre>
shr rax, cl ; rax >>= cl
shl rax, cl ; rax <<= cl
shrx r64a, r/m64, r64b; BMI2 r64a = r/m64 >> r64b
shlx r64a, r/m64, r64b; BMI2 r64a = r/m64 << r64b
psrlq mm0, mm1 ; MMX mm0 >>= mm1
psllq mm0, mm1 ; MMX mm0 <<= mm1
</pre>
'''Reset''' <br/>
<span id="ResetBit"></span>Reset a bit of square-index by [[General Setwise Operations#RelativeComplement|relative complement]] of the single bit.,
<pre>
x &= ~singleBitset; // reset bit
</pre>
or conditional toggle by single bit intersection
<pre>
x ^= singleBitset & x; // reset bit
</pre>
Set and toggle (or, xor) might the faster way to reset a bit inside a register (not, and).
=Forum Posts=
==2000 ...==
* [https://www.stmintz.com/ccc/index.php?id=306882 curiosity killed the cat... hi/lo bit C verses Assembly] by [[Dann Corbit]], [[CCC]], July 17, 2003
* [https://www.stmintz.com/ccc/index.php?id=450730 mask of highest bit] by [[Andrew Shapira]], [[CCC]], September 21, 2005
==2010 ...==
* [http://www.talkchess.com/forum/viewtopic.php?t=47710 How to Shift Left (by) a Negative Number??] by [[Steve Maughan]], [[CCC]], April 05, 2013
* [http://www.open-chess.org/viewtopic.php?f=5&t=2878 To shift or not to shift] by thevinenator, [[Computer Chess Forums|OpenChess Forum]], September 09, 2015 » [[Space-Time Tradeoff]]
* [https://groups.google.com/d/msg/fishcooking/r_7TSUtNXls/PUM5JgcSFQAJ Question about resetting a bit in a bitboard corresponding to a given square] by guenther, [[Computer Chess Forums|FishCooking]], September 09, 2016 » [[#ResetBit|Reset Bit]]
* [https://groups.google.com/forum/#!topic/fishcooking/TplkvO62I9U On the speed of SquareBB array] by protonspring, [[Computer Chess Forums|FishCooking]], March 22, 2019
==2020 ...==
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75818 C++20 standard bit operations] by [[Jon Dart]], [[CCC]], November 15, 2020 » [[Population Count]], [[BitScan]], [[Cpp|C++]]
=External Links=

Navigation menu