Advertisement
DraKiNs

[C/C++] [COD] Invert Values

Jun 26th, 2011
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.38 KB | None | 0 0
  1. /*==============================================================================
  2.              _ ____        _____          __  __
  3.             (_)  _ \ ___  |_   _|__  __ _|  \/  |
  4.             | | |_) / __|   | |/ _ \/ _` | |\/| |
  5.             | |  __/\__ \   | |  __/ (_| | |  | |
  6.             |_|_|   |___/   |_|\___|\__,_|_|  |_|
  7.  
  8.               [iPs] Inversor de Valores
  9.                Criado por: [iPs]DraKiNs
  10.                   Versão 0.1
  11. ==============================================================================*/
  12.  
  13. #include a_samp
  14.  
  15. //====== [ Functions Convert ] ===========
  16.  
  17. #define positiveNumber(%0) _:((%0 * -0xFFFFFFFF) - (%0 * 0x2)) //Convert negative to positive
  18. #define negativeNumber(%0) _:((%0 / -0xFFFFFFFF) - (%0 * 0x2)) //Convert positive to negative
  19.  
  20. //===== [ Example of Code ]   ============
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     printf("%d",negativeNumber(010)); // to 10 negative
  25.     printf("%d",positiveNumber(-25)); // to 25 positive
  26.     return true;
  27. }
  28.  
  29. //============= [ C / C++ ] ====================================
  30. #define positiveNumber(x) ((x * -0xFFFFFFFF) - (x * 0x2)) //Convert negative to positive
  31. #define negativeNumber(x) ((x / -0xFFFFFFFF) - (x * 0x2)) //Convert positive to negative
  32.  
  33. int main()
  34. {
  35.  
  36.     printf("-10 Passado para Positivo: %d \n", positiveNumber(-10));
  37.     printf("10 Passado para Negativo: %d \n", negativeNumber(10));
  38.     return system("pause");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement