<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Brad, thank you for your suggestion.</div><div class="">I ended up in testing something similar to the following example</div><div class=""><br class=""></div><div class=""><div style="color: rgb(51, 51, 51); background-color: rgb(245, 245, 245); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 16px; line-height: 24px; white-space: pre;" class=""><div class=""><span style="color: #777777;" class="">(</span><span style="color: #4b69c6;" class="">define</span> <span style="color: #777777;" class="">(</span><span style="color: #aa3731;font-weight: bold;" class="">u64-xor</span><span style="color: #7a3e9d;" class=""> . args-list</span><span style="color: #777777;" class="">)</span></div><div class="">  <span style="color: #777777;" class="">(</span>##bignum.normalize! </div><div class="">    <span style="color: #777777;" class="">(</span>fold</div><div class="">      <span style="color: #777777;" class="">(</span><span style="color: #4b69c6;" class="">lambda</span> <span style="color: #777777;" class="">(</span><span style="color: #7a3e9d;" class="">x big</span><span style="color: #777777;" class="">)</span> </div><div class="">        <span style="color: #777777;" class="">(</span><span style="color: #4b69c6;" class="">let</span> <span style="color: #777777;" class="">((</span>x-big <span style="color: #777777;" class="">(</span><span style="color: #4b69c6;" class="">if</span> <span style="color: #777777;" class="">(</span>fixnum? x<span style="color: #777777;" class="">)</span> <span style="color: #777777;" class="">(</span>#<span style="color: #9c5d27;" class="">#f</span>ixnum->bignum x<span style="color: #777777;" class="">)</span> x<span style="color: #777777;" class="">)))</span></div><div class="">          <span style="color: #777777;" class="">(</span>##bignum.adigit-bitwise-xor! big <span style="color: #9c5d27;" class="">0</span> x-big <span style="color: #9c5d27;" class="">0</span><span style="color: #777777;" class="">)</span></div><div class="">          big<span style="color: #777777;" class="">))</span></div><div class="">      <span style="color: #777777;" class="">(</span>##bignum.make <span style="color: #9c5d27;" class="">2</span> ##bignum.adigit-zeros <span style="color: #9c5d27;" class="">#f</span><span style="color: #777777;" class="">)</span></div><div class="">      args-list<span style="color: #777777;" class="">)))</span></div></div></div><div class=""><br class=""></div><div class="">it worked but with no noticeable improvements and this fact helped me in looking elsewhere to find speed problems … I found a lot of them in my code of course ;-)</div><div class=""><br class=""></div><div class="">Well I tried to do my best to fix most of the performance issues and I am now pretty happy with what I have come to, therefore I point you to my code in case you are looking for a fun "chess scheme" challenge.</div><div class=""><br class=""></div><div class=""><a href="https://github.com/pmon/coronachess" class="">https://github.com/pmon/coronachess</a></div><div class=""><br class=""></div><div class="">Thank you for your help, my best</div><div class="">Paolo</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">Il giorno 01 apr 2020, alle ore 19:15, Bradley Lucier <<a href="mailto:lucier@purdue.edu" class="">lucier@purdue.edu</a>> ha scritto:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 3/31/20 3:50 PM, Paolo Montrasi wrote:<br class=""><blockquote type="cite" class="">I am asking here for an advice in improving runtime speed crunching bitwise operations on u64 integers since I have no experience using scheme and Gambit.<br class="">Looking at the documentation I see that fixnum is providing some help but I apparently u64 integers are not "compatible" with fixnum operations<br class=""> > (fixnum? 18446744073709551615)<br class="">#f<br class="">Can you share suggestions for my next exercise<br class=""></blockquote>That may be possible using some of Gambit's low-level, internal, unsafe, very-bad-indeed routines for manipulating bignum "adigits" (for "addition digits", although they're the size used for many other things), which are 64 bits, unsigned, on 64-bit machines.  (They're only 14 bits wide in the universal backend, though.)<br class=""><br class="">You'll find these routines in _num.scm:<br class=""><br class="">;;; Sets x[i] to x[i] & y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-and! x i y j))<br class=""><br class="">;;; Sets x[i] to ~x[i] & y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-andc1! x i y j))<br class=""><br class="">;;; Sets x[i] to x[i] & ~y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-andc2! x i y j))<br class=""><br class="">;;; Sets x[i] to ~(x[i] ^ y[j]) (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-eqv! x i y j))<br class=""><br class="">;;; Sets x[i] to x[i] | y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-ior! x i y j))<br class=""><br class="">;;; Sets x[i] to ~(x[i] & y[j]) (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-nand! x i y j))<br class=""><br class="">;;; Sets x[i] to ~(x[i] | y[j]) (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-nor! x i y j))<br class=""><br class="">;;; Sets x[i] to !x[i] (accessing x as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-not! x i))<br class=""><br class="">;;; Sets x[i] to ~x[i] | y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-orc1! x i y j))<br class=""><br class="">;;; Sets x[i] to x[i] | ~y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-orc2! x i y j))<br class=""><br class="">;;; Sets x[i] to x[i] ^ y[j] (accessing x and y as adigits)<br class="">(define-prim (##bignum.adigit-bitwise-xor! x i y j))<br class=""><br class="">There's also<br class=""><br class="">(define-prim (##bignum.make k x complement?)<br class=""><br class="">which makes a new bignum with k adigits, copying x if it's given, and complementing things if the last argument is #t.  It may be easier to just call<br class=""><br class="">(define-prim (##bignum.copy x)<br class="">  (##bignum.make (##bignum.adigit-length x) x #f))<br class=""><br class="">Using one of<br class=""><br class="">(define ##bignum.adigit-ones (##fixnum->bignum -1))           ;; the 0th adigit is all ones<br class="">(define ##bignum.adigit-zeros (##fixnum->bignum 0))           ;; the 0th adigit is all zeros<br class=""><br class="">as a starter.<br class=""><br class="">Now, ##bignum.adigit-ones and ##bignum.adigit-zeros are unnormalized bignums, as could be many other results one can get by using these routines that manipulate adigits, so I wouldn't try to print them using the usual library routines, but this could get you started.<br class=""><br class="">Brad<br class=""></div></div></blockquote></div><br class=""></body></html>