Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotate left 2 bits (like assembler)
#31
one week.... Tongue
[Image: freebasic.png]
Reply
#32
About time to finish it off then imo unless lith wants to make another entry.
oship me and i will give you lots of guurrls and beeea
Reply
#33
Blitz,

I tested every combinastion of the last solution that you submitted, and congratulations, it works 100%.

You know your stuff, but the code is difficult to understand. I'll have to analyse it further.

Thanks.
*****
Reply
#34
you have to fucking get to know two's complement, yes i'm rude i have 17 hours of non stop coding behind me for univ. with stupid fucks that don't know their own name even.
quote="NecrosIhsan"]
[Image: yagl1.png]
[/quote]
Reply
#35
Moneo, are you stupid? No really.. you claim to know this stuff, when obviously you're not.


01110101 = 5
01110101 = 158
01110101 = 1232300
01110101 = "Hello, World!"


Binary is binary.


01110101 is always 01110101, how you interpret it a totally different matter.
As I just showed.


So stop whining, and read up on basic knowledge, and stop acting like you're the best coder in the freakin world.

Quote:if you compared an INTEGER of -32768 to a LONG of 32768
OFCOURSE AN INTEGER WILL NOT EQUAL A LONG! ARE YOU STUPID!? It's 16bits, and 32bits.. see the difference? It's quite subtle, but I'm sure you'll catch it if you stare at it long enough.
Reply
#36
Zire,

I'f your so clever, know all about binary, integer and long variables, and can comment on a challenge thread that's been going on more than a week, then submit a solution to back up your comments.
*****
Reply
#37
Does it have anything to do with this? :lol:

http://qbnz.com/pages/forum/viewtopic.php?t=760
Reply
#38
Quote:Zire,

I'f your so clever, know all about binary, integer and long variables, and can comment on a challenge thread that's been going on more than a week, then submit a solution to back up your comments.
*****
I offer thee, good sir, my most sincere appologies.

I shall refrain from posting in any topic unless I offer a solution to the problem at hand.

I shall also in the upcoming future refrain from posting in any topic that was started more than two weeks ago.


Again, I deeply appologize for my irrational behaviour, and swear, as God is my witness, to become a better forum member from now on.

Thank you for showing me the true path to follow, so I may redeem and better myself.


Thank you.




:roll:
Reply
#39
Moneo -Z!re was right in what he said. And this thread is becoming ridiculous. And where's your own solution?
url]http://fbide.sourceforge.net/[/url]
Reply
#40
Ok, here's my solution. Similar to Mango's solution, it is not the most elegant, is very straighforward, but it works.
Code:
REM NOTE: X is the input 16 bit value to be rotated 2 left.
REM            X2 is the output 16 bit value as an integer.

dim x as long
dim x2 as integer
dim hexC000 as long
dim hex3FFF as long
dim top2 as long
dim bot2 as long

hexC000=&HC000&             'Bit mask to isolate 2 high-order bits
hex3FFF=&H3FFF&             'Bit mask to remove  2 high-order bits

top2 = x and hexC000        'Isolate 2 high-order bits
bot2 = top2 / 2^14          'Position 2 high-order bits into 2 low-order bits

x = x and hex3FFF         'Remove 2 high-order bits from x (just in case)
x = x * 2^2               'Shift x left 2 bits
x = x or bot2             'OR in the 2 low-order bits            

REM X is the final result as long.
x2 = x                       'x2 is the final 16 bit result as integer
*****
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)