|
2025-05-09
| ||
| 18:14 | • Closed ticket [fd1585e2a1]: Continued improvements to TclLog2() and friends and ... artifact: fc1aad6f51 user: dgp | |
| 18:13 | [fd1585e2a1] Adopt efficient internal indexing calculation utility TclMSB(). check-in: e991e299b3 user: dgp tags: core-9-0-branch | |
| 18:10 | [fd1585e2a1] Adopt efficient internal indexing calculation utility TclMSB(). check-in: 7d9a0d7b95 user: dgp tags: trunk, main | |
|
2025-05-05
| ||
| 19:37 | • Ticket [fd1585e2a1] Continued improvements to TclLog2() and friends and callers<... artifact: 8089a3f95c user: dgp | |
| 11:45 | • Ticket [fd1585e2a1]: 3 changes artifact: 984c8b5da4 user: dgp | |
| 11:19 | • Ticket [fd1585e2a1]: 3 changes artifact: 7e5e07b6db user: dgp | |
|
2025-05-04
| ||
| 17:12 | • Ticket [fd1585e2a1]: 4 changes artifact: 925376ffa2 user: jan.nijtmans | |
|
2025-05-02
| ||
| 08:42 | • Ticket [fd1585e2a1]: 3 changes artifact: adaa52e3a3 user: jan.nijtmans | |
|
2025-05-01
| ||
| 20:04 | • Ticket [fd1585e2a1]: 4 changes artifact: 6a15f5405c user: oehhar | |
| 17:04 | • Ticket [fd1585e2a1]: 3 changes artifact: 119fdfe810 user: dgp | |
|
2025-04-23
| ||
| 18:40 | • Ticket [fd1585e2a1]: 3 changes artifact: c34b22d88b user: dgp | |
|
2025-04-16
| ||
| 18:12 | • New ticket [fd1585e2a1]. artifact: a4ce5f6312 user: dgp | |
Continued improvements to TclLog2() and friends and callers
Closed / Acceptedfd1585e2a1a8f8900ea63bc2c723717f5871962bCreated 2 years agoUpdated 2 years ago
Descriptionplain2025-04-16 18:12:48
[677241c9b3] recently made changes to the internal utility routine TclLog2() seeking optimization and confident extension to 64-bit range. Conflicts encountered merging the changes to the dgp-refactor branch revealed that branch holds considerably more improvements ready to deploy. A new branch dgp-msb has been opened to bring those changes over to the trunk in a sequence of commits. When the whole revision is complete, I will be seeking review to approve accepting all the changes for merge to trunk and backport to appropriate branches.
Referenced by2
e991e299b3[fd1585e2a1] Adopt efficient internal indexing calculation utility TclMSB(). check-in2025-05-09 18:13:177d9a0d7b95[fd1585e2a1] Adopt efficient internal indexing calculation utility TclMSB(). check-in2025-05-09 18:10:25
dgpplain2025-04-23 18:40:46
The dgp-msb branch is ready for an independent review of suitability to merge to trunk.
dgpplain2025-05-01 17:04:41
Anyone willing to look?
oehharwiki2025-05-01 20:04:20
Dopnald, this is clear wizard work. I even have no idea of the purpose. There are assembler intrinsics etc.
No way for me, sorry.
Take care, Harald
jan.nijtmanswiki2025-05-02 08:42:16
I like the idea (and the implementation looks good)
I scheduled a build tonight, let's see what Github ACTIONS thinks.
jan.nijtmanswiki2025-05-04 17:12:09
The testcases show this:
==== brodnik-1.0 TclMSB correctness FAILED
==== Contents of test case:
testmsb $v
---- Result was:
-1
---- Result should have been (exact matching):
0
==== brodnik-1.0 FAILED
Same failure on all platforms
dgpplain2025-05-05 11:19:49
All platforms except mine I guess. Will look into it.
dgpplain2025-05-05 11:45:24
Have to take care at the input range boundaries to not be testing undefined behaviors. Thanks! Should be better now.
dgpplain2025-05-05 19:37:41
Answering question about the non-support for an input of 0 to TclMSB(). Since the binary representation of 0 has no set bits, it is unclear what the correct answer should be to the question what is the index of the most significant set bit. A return value of 0 is effectively an assertion that the input value 0 is no different from the input value 1. Far from clear that's an acceptable equivalence to all callers. A return value of -1 succeeds in treating an input value 0 as something unlike any other input. However, most known callers of TclMSB() have the intent of using the return value as an index, and a negative index is not usually welcome. Such callers would need to post-process the return value to treat -1 differently. This is no better than expecting the caller to treat an input value of 0 differently before making the TclMSB() call. Either way, there's a testing branch needed if the caller knows a value of 0 is a possibility. FWIW, it is also true that this unsupported input value reflects the same unsupported input value in the most efficient implementations. The limitations of clzll(), etc. are just showing through.
dgpplain2025-05-09 18:14:00
Accepted into 9.0 and 9.1 development.
Log in (anonymous is fine) to add a comment.