Author Topic: How to operate a 64 bit long long integer?  (Read 1982 times)

0 Members and 1 Guest are viewing this topic.

baitang36

  • Bull Frog
  • Posts: 213
How to operate a 64 bit long long integer?
« 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

d2010

  • Bull Frog
  • Posts: 323
Re: How to operate a 64 bit long long integer?
« Reply #1 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.                               

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: How to operate a 64 bit long long integer?
« Reply #2 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.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

baitang36

  • Bull Frog
  • Posts: 213
Re: How to operate a 64 bit long long integer?
« Reply #3 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?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8661
  • AKA Daniel
Re: How to operate a 64 bit long long integer?
« Reply #4 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

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8661
  • AKA Daniel
Re: How to operate a 64 bit long long integer?
« Reply #5 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.  



« Last Edit: June 22, 2022, 10:47:46 PM by It's Alive! »

d2010

  • Bull Frog
  • Posts: 323
Re: How to operate a 64 bit long long integer?
« Reply #6 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:

baitang36

  • Bull Frog
  • Posts: 213
Re: How to operate a 64 bit long long integer?
« Reply #7 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

d2010

  • Bull Frog
  • Posts: 323
Re: How to operate a 64 bit long long integer?
« Reply #8 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?

baitang36

  • Bull Frog
  • Posts: 213
Re: How to operate a 64 bit long long integer?
« Reply #9 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

baitang36

  • Bull Frog
  • Posts: 213
Re: How to operate a 64 bit long long integer?
« Reply #10 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

d2010

  • Bull Frog
  • Posts: 323
Re: How to operate a 64 bit long long integer?
« Reply #11 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)




baitang36

  • Bull Frog
  • Posts: 213
Re: How to operate a 64 bit long long integer?
« Reply #12 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
« Last Edit: August 24, 2022, 05:43:46 AM by baitang36 »