How to enable __int128 on Visual Studio?

前端 未结 6 1321
天命终不由人
天命终不由人 2020-11-28 13:29

When I type __int128 in a C++ project in Visual Studio, the editor changes color of __int128 to blue (like keyword).

But when I compile the

6条回答
  •  旧巷少年郎
    2020-11-28 14:16

    There is a new version of _int128 which solves some of the problems mentioned. It includes a natvis addin, so you can view int128 in the debugger. To do this it was nessecary to write an x86 version of int128, because natvis-dll's need to be win32. The idea of using af template for the members lo,hi is ok, but I think it's a little to optimistic, because the routines that do the real job have to use the CPU's registers which, at least at the moment, are only 64 bit. But ok when Intel releases a 128-bit CPU. in/out in c++ std stream are added A lot of inline operators have been added too, so the compiler will do

    _int128 x = 10;
    int y = 20;
    _int128 z = x + y;
    

    without ambiguities.

    The code is too big to fit in this answer so it's put in github with links to the files listet below

    New header Int128.h

    Int128x64.asm Assembler code for x64

    Int128x86.cpp

    Int128Str.cpp Common for x86 and x64

    Int128IO.cpp Common for x86 and x64

    AddIn-dll called by debugger to convert _int128/_uint128 to char*(decimal/hex)

    Header for all natvis addin dll's

提交回复
热议问题