[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Base256 to int

Posted on 2006-10-24
Medium Priority
Last Modified: 2008-02-01
Does anybody know how to convert a string (base 256 number) to integer?
Question by:TiborKi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 28

Accepted Solution

2266180 earned 500 total points
ID: 17796908
LVL 46

Expert Comment

ID: 17798414
How big is the string?
The ciuly link is probably the easiest solution.

Author Comment

ID: 17798517
the string is 4 bytes
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 46

Expert Comment

ID: 17798626
The only problem you are likely to encounter is signed versus unsigned integer values.  If the high-order bit of the high-order byte = 1 then a signed integer will be negative.

Is this a performance critical function or do you simply need to know how it can be done?

Author Comment

ID: 17798790
well, it must be fast...
LVL 46

Assisted Solution

aikimark earned 500 total points
ID: 17798999
"fast" is relative.  The best course of action will be to try the ciuly linked solution and determine if it suits your needs as far as functionality and speed.  If it doesn't, then ask us for more help.

For future readers, there are several approaches available to do this conversion.
* character->ord add and shiftLeft 8 (three statement pairs followed by simple add)
* similar to above, but using For iteration construct
* Delphi Copy function or API call to copy bytes directly into integer variable.  May require additional ntohl API call to reverse the byte order to accomodate Little-endian Windows environment.  This solution can get really tricky, depending on the nature of the 'string variable'.  Due to complexity, this should be solution approach of last resort.
* ASM solution (see the FastCode project)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question