negative hexadecimal conversion to integer, without FFFFFF prefix .

Apr 26, 2013 at 3:56pm

negative hexadecimal conversion to integer, without FFFFFF prefix .

hi all ,
i would lke to do this ,
how would you convert :

FFFFFF27 , to 2 and 7 ,
or , another example :
FFFFFF2E , to 2 and E

i still can’t get the way to remove those “F” , and separate the 2 numbers (or letters) following , in a list or else .
it seems so easy …

i ‘ll try to find out before anybody answers ,
and will triumph .

i’ m also ok to loose the challenge .

ready , go !

#67959
Apr 26, 2013 at 4:05pm

here’s a patch that shows this

– Pasted Max Patch, click to expand. –
#244250
Apr 26, 2013 at 4:17pm

Maybe this:

– Pasted Max Patch, click to expand. –
#244251
Apr 26, 2013 at 5:15pm

hi Patrick ,
thanks for the patch ,
that bitwise intersection object obviously seems to be the key ,
i must admit i don’t understand yet … that’s very cool !
but i’m not sure we’re resolving my problem completely ,
maybe it’s done 99% , …
i’ll try to explain more .

the hex number we’re working on will always be in the range (-255 –> 0) , sorry the range (FFFFFF01 –> 0)
( i know numbers are numbers are numbers , but i think it’s important )
for the example of the value “FFFFFF2E” (-210) ,
i have to remove these FFFFFF ,
then we have 2E , or 2 and E .
i have to perform another conversion , which is (weird ?) :
2 has to be considered as an ASCII character , and converted to a decimal —-> 50
E has to be considered as an ASCII character , and converted to a decimal —-> 69

!!!!! and we’ve got it !!!!! 50 69

my problem is that i can’t get the letter “E” outputted, from a number box , even if it’s displaying hex .
it will only output decimal .

but maybe i have (once again) let some evidence come to me ,
without shaking hands .

i don’t think we can fill a message box with a letter , with this (thank you again) patch ,
can we ?

Matthieu

#244252
Apr 26, 2013 at 5:41pm
– Pasted Max Patch, click to expand. –
#244253
Apr 26, 2013 at 7:43pm

oooooo
it seems to work perfectly , in all the cases ,

thank you very much Patrick
trop cool !

you surely saved me a looot of time ,
i now have to understand this “&” object .

that’s a good lesson to learn for me ,
let’s go !

wish you the best ,
have nice week-end

Matthieu

#244254
Apr 28, 2013 at 9:12pm

did you know about the [atoi] object ?
you can also use regular expressions to strip the FFFFFF out of your message and use atoi to process the two remaining caracters…

– Pasted Max Patch, click to expand. –
#244255
Apr 29, 2013 at 7:49pm

@(karrrlo): as joumik pointed out, a number is a number is a number, but it is not a symbol.
What he seems to manipulate are negative numbers, represented in hexadecimal. So you first need to convert the number in an hex symbol. I think this could be done with sprintf but I’m too far away from Max to be able to test this (I checked your patch using http://www.ahmetkizilay.com/ptc/ :-)
You’re right about atoi, of course. I just wanted to show joumik it was quite an obvious conversion to do without any specialized object.

#244256
May 17, 2013 at 3:23pm

hi , thanks to both of you .

yes , atoi was very sexy !

everything ‘s working good now ,

thanks again

Matthieu

PS:   http://www.ahmetkizilay.com/ptc/   is very cool ! 

 

#249711
May 19, 2013 at 1:56pm

@Patrick  Delges , i was’t exactly sure what Joumik needed as i was reading through the posts in diagonals , and it was a quick response i gave with the little time i had that day + your response was far more detailed  :)

and thanks for the  http://www.ahmetkizilay.com/ptc/ link, this is just wonderful !!!

@joumik glad everything is working out for you

 

 

#249846

You must be logged in to reply to this topic.