Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6312c6358a07f84b91a145f2372a34477b69117880282fd18c989cdc640c6063
Ticket: 931802a0f552db2e96d2ecf2439bdfb393b49451
Require Tcl_WideInt/Tcl_WideUInt to be exactly 64 bits
User & Date: chrstphrchvz on 2022-09-06 09:11:04
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    Both TIP 72 and the IntObj documentation say that <tt>Tcl_WideInt</tt> (wide integer, and <tt>Tcl_WideUInt</tt> unsigned wide integer) is "at least" 64 bits. For clarity and compatibility, I would propose requiring <tt>Tcl_WideInt</tt> to be exactly 64 bits, at least until some future Tcl version.
    
    Some compilers on some platforms, such as GCC and Clang on 64-bit (but not 32-bit), already offer an <tt>__int128</tt> type. 128-bit arithmetic is accomplished using several 64-bit operations, since it is not natively supported by hardware (general purpose register file/ALU), similar to how 64-bit operations are accomplished on 32-bit platforms. But even without native 128-bit arithmetic, <tt>__int128</tt> could still be far faster than bignum for any Tcl applications doing up to 128-bit computing.
    
    However, I would think far more software, including core Tcl, would be broken by defining <tt>Tcl_WideInt</tt> as wider than 64-bit. And following TIP 484, there is presumably little interest in Tcl once again having two "native" integer types (wide and double-wide).
    
    So maybe defining <tt>Tcl_WideInt</tt> as anything other than 64 bit, e.g.<tt>__int128</tt>, should be forbidden. Alternatively, if <tt>Tcl_WideInt</tt> is to ever be redefined as (preferably exactly) 128-bit, it should be done by some future Tcl version when the ABI is allowed to change.
    
  5. is_private changed to: "0"
  6. login: "chrstphrchvz"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "chrstphrchvz"
  12. subsystem changed to: "10. Objects"
  13. title changed to:
    Require Tcl_WideInt/Tcl_WideUInt to be exactly 64 bits
    
  14. type changed to: "RFE"