Addresses of 2 integer variables are on the stack as the parameters.
Sample c call: swap( &num1, &num2);
You must implement the following C swap function:
Swaps the two values pointed to by x_ptr and y_ptr.
void swap (int *x_ptr, int *y_ptr)
if (x_ptr != y_ptr)
*x_ptr ^= *y_ptr; /* note that ^ means xor */
*y_ptr ^= *x_ptr;
*x_ptr ^= *y_ptr;
The values of the two integer parameters have been exchanged.
I'm fairly new to Assembly myself, is there a reason something like this wouldn't work?
xchg eax, ebx ; swap Value1 and Value2
That exchanges the two integers in the registers all right, but doesn't save the values in the memory addresses of the two pointers. The results still have to be saved at those addresses. But that xchg instruction isn't needed for the simple swap in this program -- wasted CPU time.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...