Modify

Opened 16 years ago

Closed 15 years ago

#424 closed Feature Request (Duplicate)

_Dec64()

Reported by: Albuquerque Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: QWORD, Hex, Dec Cc:

Description

I had a bit of frustration when trying to convert an IPv4 address to the format used by Microsoft SCCM's database table. To get to the crux of the issue, I needed to convert a full QWORD to an integer number. The problem is that anything over 0x7FFFFFFF piped into the Dec() function results in a negative number -- seems that the Dec() function assumes input will always be a DWORD.

So, I wrote a stupidly simple converter for my own needs, but thought I'd send this up the food chain to see if it's something you good folks would be interested in...

Further, I'll note that I went cruising through all the include functions and couldn't find one similar to what I needed. If there really is one in there, I apologize profusely for being redundant -- but could you point me to it?

Here's my stupidly simple AutoIT code (that obviously has none of the correct error checking for ubiquiteous use as-is, but I digress...)

Func _Dec64($hexValue)
    $intValue = 0
    For $i = StringLen($hexValue) to 1 Step -1
        $intBase = Dec(StringMid($hexValue,$i,1))
        $intExponent = 16 ^ (StringLen($hexValue) - $i)
        $intFinal = $intBase * $intExponent

        $intValue = $intValue + $intFinal
    Next
    Return $intValue
EndFunc ;; _Dec64()

Attachments (0)

Change History (3)

comment:1 Changed 16 years ago by TicketCleanup

  • Version 3.2.12.0 deleted

Automatic ticket cleanup.

comment:2 Changed 16 years ago by Ultima

I'm not sure how much trouble it would be, but I think (if at all possible) AutoIt's built-in integer functions need to have added support for handling a entire int64 variant. I also ran into the "only 32-bit integers supported" issue recently, and had to come up with some funky recently, and had to come up with some funky workaround (which I suspect might fail depending on architecture, though I can't be too sure).

I stopped by this bugtracker to request for the change (to have the bitwise operators be int64-aware), but found this ticket... which sounds similar enough that it would probably do better to keep the entire request in a single ticket.

Ticket summary change? "Support int64 in more/all integer-related functions (where it makes sense)" (or something to that effect).

comment:3 Changed 15 years ago by Valik

  • Resolution set to Duplicate
  • Status changed from new to closed

I just created #767 with a better title/description about for improved 64-bit integer support. I'm closing this as a duplicate.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.