1 Replies - 8912 Views - Last Post: 24 January 2011 - 10:21 AM

#1 Guest_owen999*


Reputation:

Detecting length of string in ARM Assembly

Posted 24 January 2011 - 05:36 AM

Hey,

I have almost finished a piece of code which finds the mode of a set of numbers. The numbers are stored in an address in memory.

However, at the moment I have to manually enter the number of values I want to test. For instance, if there are 12 values in memory I want to find the mode of, I have to have EQU 12 at the beginning of my code.

There must be a way of detecting the number of values stored?

Any help would be much appreciated.

Thanks!

Is This A Good Question/Topic? 0

Replies To: Detecting length of string in ARM Assembly

#2 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Detecting length of string in ARM Assembly

Posted 24 January 2011 - 10:21 AM

if your strings are NULL terminated then you can find the length by looping though and incrementing a value as you go until you hit the NULL. it's how the clib function strlen(char*) works ;). you could also store the string in a qword with the first part being the pointer and the second part being a size, this way you must modify the size as necessary however.

This post has been edited by ishkabible: 24 January 2011 - 10:23 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1