<i>Continued improvements to TclLog2() and friends and callers</i> status still Open with 3 other changes
by
.
D 2025-05-05T19:37:41.759
J icomment \r\nAnswering\squestion\sabout\sthe\snon-support\sfor\san\sinput\sof\s0\sto\sTclMSB().\r\n\r\nSince\sthe\sbinary\srepresentation\sof\s0\shas\sno\sset\sbits,\sit\sis\sunclear\r\nwhat\sthe\scorrect\sanswer\sshould\sbe\sto\sthe\squestion\swhat\sis\sthe\sindex\r\nof\sthe\smost\ssignificant\sset\sbit.\r\n\r\nA\sreturn\svalue\sof\s0\sis\seffectively\san\sassertion\sthat\sthe\sinput\svalue\s0\r\nis\sno\sdifferent\sfrom\sthe\sinput\svalue\s1.\s\sFar\sfrom\sclear\sthat's\san\r\nacceptable\sequivalence\sto\sall\scallers.\r\n\r\nA\sreturn\svalue\sof\s-1\ssucceeds\sin\streating\san\sinput\svalue\s0\sas\ssomething\r\nunlike\sany\sother\sinput.\s\sHowever,\smost\sknown\scallers\sof\sTclMSB()\shave\sthe\r\nintent\sof\susing\sthe\sreturn\svalue\sas\san\sindex,\sand\sa\snegative\sindex\sis\snot\r\nusually\swelcome.\s\sSuch\scallers\swould\sneed\sto\spost-process\sthe\sreturn\svalue\r\nto\streat\s-1\sdifferently.\s\sThis\sis\sno\sbetter\sthan\sexpecting\sthe\scaller\sto\r\ntreat\san\sinput\svalue\sof\s0\sdifferently\sbefore\smaking\sthe\sTclMSB()\scall.\s\r\nEither\sway,\sthere's\sa\stesting\sbranch\sneeded\sif\sthe\scaller\sknows\sa\svalue\r\nof\s0\sis\sa\spossibility.\r\n\r\nFWIW,\sit\sis\salso\strue\sthat\sthis\sunsupported\sinput\svalue\sreflects\sthe\r\nsame\sunsupported\sinput\svalue\sin\sthe\smost\sefficient\simplementations.\s\sThe\r\nlimitations\sof\sclzll(),\setc.\sare\sjust\sshowing\sthrough.
J login dgp
J mimetype text/plain
K fd1585e2a1a8f8900ea63bc2c723717f5871962b
U dgp
Z a4e9e12c64a8e2a35cb6696f56928c3a