www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - long long support in 16 bit memory models?

reply Drago <core email.t-com.hr> writes:
I know long long is currently not supported in 16bit memory models.
Why is that so?
Do you plan to include it in future versions?


I'm working on an embedded application that is using barcodes, and long long
support would make thing much simpler. Alternatively I know I can use some of
big-int libraries (or do my own code) but they are slow and take a lot of in
the final executable, and in embedded enviroment each byte counts...
Jan 07 2012
parent reply "GEB" <george_breese partech.com> writes:
On Saturday, 7 January 2012 at 19:37:11 UTC, Drago wrote:
 I know long long is currently not supported in 16bit memory 
 models.
 Why is that so?
 Do you plan to include it in future versions?


 I'm working on an embedded application that is using barcodes, 
 and long long
 support would make thing much simpler. Alternatively I know I 
 can use some of
 big-int libraries (or do my own code) but they are slow and 
 take a lot of in
 the final executable, and in embedded enviroment each byte 
 counts...
I also would like to request such a feature. In my case, I am working with logical disk sectors, the 64-bit memory addresses returned by INT 15H/E820H calls, and I'm using the Pentium TSC register for timing.
Aug 25 2014
parent GEB <bob io.com> writes:
On Monday, 25 August 2014 at 14:14:19 UTC, GEB wrote:
 On Saturday, 7 January 2012 at 19:37:11 UTC, Drago wrote:
 I know long long is currently not supported in 16bit memory 
 models.
 Why is that so?
 Do you plan to include it in future versions?


 I'm working on an embedded application that is using barcodes, 
 and long long
 support would make thing much simpler. Alternatively I know I 
 can use some of
 big-int libraries (or do my own code) but they are slow and 
 take a lot of in
 the final executable, and in embedded enviroment each byte 
 counts...
I also would like to request such a feature. In my case, I am working with logical disk sectors, the 64-bit memory addresses returned by INT 15H/E820H calls, and I'm using the Pentium TSC register for timing.
I ended up implementing a C++ class using the FPU's native 64-bit integer support. It worked, but was clunky. I eventually located a different compiler that natively supported 64-bit integers in 16-bit compilation. I still keep DM C++ around because I have a lot of projects built under it. Sample code from the C++ class: #define MDAS_ADD 1 #define MDAS_SUB 2 #define MDAS_MUL 3 #define MDAS_DIV 4 // Common code to handle multiply/divide/add/subtract void INT64::MDAS(const INT64 & p1, BYTE uop) { // void far * pthis = &m_value.d; _asm { push ds; lds bx, pthis; fild qword ptr ds:[bx]; lds bx, p1; fild qword ptr ds:[bx]; mov al, uop cmp al, MDAS_ADD jnz uo1 faddp st(1),st; jmp short end; uo1: cmp al, MDAS_SUB; jnz uo2; fsubp st(1),st; jmp short end; uo2: cmp al, MDAS_MUL; jnz uo3; fmulp st(1),st; jmp short end; uo3: fdivp st(1),st; // jmp short end; end: lds bx, pthis; fistp qword ptr ds:[bx]; pop ds; }; } void INT64::operator +=(const INT64 & p1) { MDAS(p1, MDAS_ADD); }
Oct 10 2017