Holloweye Posted May 20, 2010 Share Posted May 20, 2010 Is it possible to change order of a int ex: 523 to 325. with only mathematical operations? And if yes, how? (Possible for you to use XOR,OR,AND) Thanks Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted May 20, 2010 Share Posted May 20, 2010 I'm sure there are more elegant solutions but you could simply convert to a string, swap the characters and convert back to an int again! You can shift left and right in registers to do this sort of thing but that's in binary which isn't going to give the result you're after (not without going beyond my limited maths anyway lol). I am intrigued as to why you want to do this though! Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Holloweye Posted May 20, 2010 Author Share Posted May 20, 2010 I'm sure there are more elegant solutions but you could simply convert to a string, swap the characters and convert back to an int again! Yeah I know but i'am using assembly (Intel). And it get really messy when I do that so I figured if there was another solution. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted May 20, 2010 Share Posted May 20, 2010 Now you have got me interested ... why assembly language .... what requires such speed that you're forced to use assembler or is it just an exercise ? Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Holloweye Posted May 20, 2010 Author Share Posted May 20, 2010 Now you have got me interested ... why assembly language .... what requires such speed that you're forced to use assembler or is it just an exercise ? It's for school Quote Link to comment Share on other sites More sharing options...
Canardia Posted May 20, 2010 Share Posted May 20, 2010 But school is meant that you solve things yourself (it's much more fun!), than ask other people. If you actively participate and teach the teacher (I had to teach my physics teacher that electrons are actually (at least) 5 dimensional, so they can appear in multiple places at the same time), all hours feel like 10 minutes to you, so you can speed up the time in school a lot too. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Holloweye Posted May 20, 2010 Author Share Posted May 20, 2010 Solved it on another way but thanks anyway. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.