Re: Radix Cocoa Class: Int Binary Value to Char String
Re: Radix Cocoa Class: Int Binary Value to Char String
- Subject: Re: Radix Cocoa Class: Int Binary Value to Char String
- From: Camillo Lugaresi <email@hidden>
- Date: Fri, 6 Jan 2006 20:27:11 +0100
On 06/gen/06, at 19:19, Jordan Evans wrote:
Say I have a multibase string, where the string is
three digits long. The most significant digit is base
ten, the second most significant digit is base 16 and
the first digit is base 8.
So the value of abc is a*100+b*16+c, with a in [0..9], b in [0..15]
and c in [0..7]? With such a system, you cannot even represent the
number 10. Why would you want to use something like that?
The class that I provided
is a draft of what will find any sequence according
the situation I just explained with multibase strings,
but it's really an algorithm that would be best for
producing all results, which is fine, but I need one
that produces one result. So, that's why I need a
very fast algorithm that turns a integer value into a
string, so I can integrate with this drafted Radix
class.
IMHO, what you need is to avoid "multibase strings" entirely.
On 06/gen/06, at 19:36, Jordan Evans wrote:
This works great, with a couple of smalls fixes. But,
I didn't want to use anything with mod or division.
If the radix is a power of 2, you can use bit shifting and masking
instead, but for other radixes you need division.
Again I'm looking for a way to write this by only
using these operators: shift, is equal, is not equal,
addition, subtraction, and the bitwise operators: & |
^
You can do that if you write a division algorithm in software, but it
will be slower than using one of the division instructions of the CPU.
If no one here knows, I'll probably just put in your
idea so I can move on and think about it later. This
this stuff is interesting to me, I'd really like to
know how the search is done using more primitive operators.
I'm not sure I understand what you are searching for. Maybe things
would become clearer if you explained what you need to accomplish at
a higher level.
Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden