TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: baitang36 on June 17, 2022, 09:18:45 PM

Title: How to operate a 64 bit long long integer?
Post by: baitang36 on June 17, 2022, 09:18:45 PM
(setq a(vlax-make-variant 12345678901234567))
return:  #<variant 5 1.23456789012346E+16>
i need a  long long integer
Title: Re: How to operate a 64 bit long long integer?
Post by: d2010 on June 20, 2022, 06:49:50 AM
Okai ,even  you got  int64  for Lisp,   the "int64" is vannish
 if the speed of int64 is too'slow..
Please  you  search other  Method for store      Int32 and int64,because   
the   VLisp'Intrepretor calculate numbers each time.                               
Title: Re: How to operate a 64 bit long long integer?
Post by: JohnK on June 20, 2022, 04:03:27 PM
maybe use a safearray?
Code - Auto/Visual Lisp: [Select]
  1. (vlax-make-safearray vlax-vbLong '(1 . 80))  ; -Make a very large array of numbers.
Title: Re: How to operate a 64 bit long long integer?
Post by: baitang36 on June 21, 2022, 01:25:09 AM
maybe use a safearray?
Code - Auto/Visual Lisp: [Select]
  1. (vlax-make-safearray vlax-vbLong '(1 . 80))  ; -Make a very large array of numbers.
(vlax-make-variant 1234567890123456789 20)
#<variant 20 1234567890123456768>
why?
Title: Re: How to operate a 64 bit long long integer?
Post by: It's Alive! on June 22, 2022, 09:29:48 PM
maybe use a safearray?
Code - Auto/Visual Lisp: [Select]
  1. (vlax-make-safearray vlax-vbLong '(1 . 80))  ; -Make a very large array of numbers.
(vlax-make-variant 1234567890123456789 20)
#<variant 20 1234567890123456768>
why?

Its not supported, vlax-variant-value fails.

Also
Quote
// These next two codes are added for developer convenience and are
// not supported by entity access, dxf, xdata or xrecord routines.
// They are, however, supported by the resbuf utility functions
// (acutBuildList, acutNewRb and acedInvoke).
//
#define RTLONG_PTR 5030 // integer value with pointer precision
#define RTINT64    5031 // integer value with 64-bit precision

so it seems its possible to hack around this by storing values in ARX
maybe you can store large values in something like (LowPart . HighPart), like LARGE_INTEGER in C++, caveat, you'd have to write your own math operators
Title: Re: How to operate a 64 bit long long integer?
Post by: It's Alive! on June 22, 2022, 10:43:05 PM
using 9223372036854775807 (max int64) as a test in ARX

(set64 9223372036854775807) fails because it comes through as a double, so I think that's a maximum of 53bits .?.
(get64) returns 9223372036854775807, so that's a success


BricsCAD sees the int64 as a int16, so... looks like your SOL

code for reference
Code - C: [Select]
  1.     static int ads_set64(void)
  2.     {
  3.         resbuf* pRb = acedGetArgs();
  4.         if (pRb->restype == RTINT64)
  5.         {
  6.             acutPrintf(_T("\nsuccess, %ls"), std::to_wstring(pRb->resval.mnInt64).c_str());
  7.             acedRetT();
  8.         }
  9.         acedRetNil();
  10.         acutRelRb(pRb);
  11.         return (RSRSLT);
  12.     }
  13.  
  14.     static int ads_get64(void)
  15.     {
  16.         resbuf* pRb = acutNewRb(RTINT64);
  17.         pRb->resval.mnInt64 = 9223372036854775807;
  18.         acedRetList(pRb);
  19.         acutRelRb(pRb);
  20.         return (RSRSLT);
  21.     }
  22.  



Title: Re: How to operate a 64 bit long long integer?
Post by: d2010 on June 27, 2022, 10:18:12 AM
You increase eating-memory too much, after you use many integers64.
Converting int64 to string, is too many digits chars..

(setq a(vlax-make-variant 12345678901234567))
return:  #<variant 5 1.23456789012346E+16>
i need a  long long integer

Do you know; how to convert int64 to string without idiv10?
 :idiot2:
Title: Re: How to operate a 64 bit long long integer?
Post by: baitang36 on June 28, 2022, 08:52:56 PM
using 9223372036854775807 (max int64) as a test in ARX

(set64 9223372036854775807) fails because it comes through as a double, so I think that's a maximum of 53bits .?.
(get64) returns 9223372036854775807, so that's a success


BricsCAD sees the int64 as a int16, so... looks like your SOL

code for reference
Code - C: [Select]
  1.     static int ads_set64(void)
  2.     {
  3.         resbuf* pRb = acedGetArgs();
  4.         if (pRb->restype == RTINT64)
  5.         {
  6.             acutPrintf(_T("\nsuccess, %ls"), std::to_wstring(pRb->resval.mnInt64).c_str());
  7.             acedRetT();
  8.         }
  9.         acedRetNil();
  10.         acutRelRb(pRb);
  11.         return (RSRSLT);
  12.     }
  13.  
  14.     static int ads_get64(void)
  15.     {
  16.         resbuf* pRb = acutNewRb(RTINT64);
  17.         pRb->resval.mnInt64 = 9223372036854775807;
  18.         acedRetList(pRb);
  19.         acutRelRb(pRb);
  20.         return (RSRSLT);
  21.     }
  22.  

(setq aa(vlax-variant-value(vlax-make-variant 15000000000 20)))
aa is a int64 number
Title: Re: How to operate a 64 bit long long integer?
Post by: d2010 on June 29, 2022, 04:23:25 PM
Okai
(setq aa(vlax-variant-value(vlax-make-variant 15000000000 20)))
How to read the "aa"?
How to add the aa+other number?
How to divide aa / int32?
Title: Re: How to operate a 64 bit long long integer?
Post by: baitang36 on July 02, 2022, 11:45:12 PM
Okai
(setq aa(vlax-variant-value(vlax-make-variant 15000000000 20)))
How to read the "aa"?
How to add the aa+other number?
How to divide aa / int32?
aa is INT,but can not add sub
Title: Re: How to operate a 64 bit long long integer?
Post by: baitang36 on July 19, 2022, 12:12:57 AM
command: (setq aa(vlax-variant-value(vlax-make-variant 15000000000 20)))
15000000000
command: !aa
15000000000
command: (type aa)
INT
Title: Re: How to operate a 64 bit long long integer?
Post by: d2010 on August 23, 2022, 10:51:56 AM
i discovered your issue with int64, inside Borland-Delphi BDS..
They, BdsTeam found, reserarch team,
 the first step at integer64, is== "blocked the variable Types inside entire.program"

 :sleezy: How to block the AllVariablesLisp with one type?
 :sleezy: How to block the AllVariablesLisp.vlx with one type?
Code: [Select]
(setq a1int 100 or nil)
(setq a2real 3.14 or nil)



Title: Re: How to operate a 64 bit long long integer?
Post by: baitang36 on August 24, 2022, 05:37:36 AM
I found that FAS has a 64 bit integer type and an unpublished function _ addr-of, which can obtain the memory address of a symbol. In 64 bit CAD, this address is a 64 bit integer.
command: (LOAD "C:/00/tranf 90.fas")
T
command: (tranf "_addr-of")
T
command: (_addr-of princ)
2722035656448