Author Topic: can any one explain the code?  (Read 1068 times)

0 Members and 1 Guest are viewing this topic.

Offline me_newbie

  • New Member
  • Posts: 3
can any one explain the code?
« on: 2011-11-29 15:16:57 »
Hi Guys!
can any one explain to me what the following code will do?

Code: [Select]

         movl %esp, %ebp
subl $20, %esp
call rand
movl %eax, %ecx
movl $1717986919, -24(%ebp)
movl -24(%ebp), %eax
imull %ecx
sarl $5, %edx
movl %ecx, %eax
sarl $31, %eax
movl %edx, %ebx
subl %eax, %ebx
movl %ebx, %eax
movl %eax, -12(%ebp)
movl -12(%ebp), %edx
movl %edx, %eax
sall $2, %eax
addl %edx, %eax
sall $4, %eax
movl %ecx, %edx
subl %eax, %edx
movl %edx, %eax
movl %eax, -12(%ebp)
movl    %eax,x1
call rand
movl %eax, %ecx
movl $715827883, -24(%ebp)
movl -24(%ebp), %eax
imull %ecx
sarl $2, %edx
movl %ecx, %eax
sarl $31, %eax
movl %edx, %ebx
subl %eax, %ebx
movl %ebx, %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %edx
movl %edx, %eax
addl %eax, %eax
addl %edx, %eax
sall $3, %eax
movl %ecx, %edx
subl %eax, %edx
movl %edx, %eax
movl %eax, -8(%ebp)
movl    %eax,y1

BR,

Ewa

Offline p1ranha

  • Community Staff
  • Code Warrior
  • *****
  • Posts: 218
Re: can any one explain the code?
« Reply #1 on: 2011-11-29 15:44:21 »
Since you didn't write it ( you'd know what it does if you did ) the questions back at you are:
1) where did you obtain it from?
2) why do you care what it does?

Offline me_newbie

  • New Member
  • Posts: 3
Re: can any one explain the code?
« Reply #2 on: 2011-11-29 15:48:42 »
Hi !
i got it from internet and it generates two random numbers which i need, so is it enough to tell you?

BR,

Ewa

Offline me_newbie

  • New Member
  • Posts: 3
Re: can any one explain the code?
« Reply #3 on: 2011-11-29 16:10:23 »
Hi !

or if someone know the easy way to generating two random numbers in the reason between 80 * 25

i need two values one x-axis and other for y-axis but in the range

Offline p1ranha

  • Community Staff
  • Code Warrior
  • *****
  • Posts: 218
Re: can any one explain the code?
« Reply #4 on: 2011-11-29 16:21:38 »
Why not just use rand() to get your two values???
See this simple article: http://www.cprogramming.com/tutorial/random.html