Advertisement
Mysoft

Untitled

Oct 19th, 2016
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "crt.bi"
  2. #macro SetArray( _Arr , _Vals... )
  3.   scope
  4.     dim as typeof(_Arr(0)) ArrTemp(lbound(_Arr) to ubound(_Arr)) = _Vals    
  5.     memcpy( @_Arr(lbound(_Arr)) , @ArrTemp(lbound(ArrTemp)) , ((ubound(_Arr)-lbound(_Arr))+1)*sizeof(_Arr(0)) )
  6.   end scope
  7. #endmacro
  8. #macro SetArrayConst( _Cnt , _Arr ,  _Vals... )
  9.   scope
  10.     static as typeof(_Arr(0)) ArrTemp((_Cnt)-1) = _Vals    
  11.     memcpy( @_Arr(lbound(_Arr)) , @ArrTemp(0) , (_Cnt)*sizeof(_Arr(0)) )
  12.   end scope
  13. #endmacro
  14.  
  15.  
  16. dim as integer NN(7)
  17. dim as double TMR
  18.  
  19. TMR = timer
  20. for N as integer = 0 to 2^20
  21.   SetArray( NN , { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 } )
  22. next N
  23. print (timer-TMR)*1000;"ms - SetArray()", NN(6)
  24.  
  25. TMR = timer
  26. for N as integer = 0 to 2^20
  27.   SetArrayConst( 8 , NN , { 00 , 11 , 22 , 33 , 44 , 55 , 66 , 77 } )
  28. next N
  29. print (timer-TMR)*1000;"ms - SetArrayConst()", NN(6)
  30.  
  31. TMR = timer
  32. for N as integer = 0 to 2^20
  33.   NN(0)=0:NN(1)=111:NN(2)=222:NN(3)=333:NN(4)=444:NN(5)=555:NN(6)=666:NN(7)=777
  34. next N
  35. print (timer-TMR)*1000;"ms - 'Manual Set'", NN(6)
  36.  
  37.  
  38. sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement