math.c 902 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * arm/math.c - math routines for ARM
  3. *
  4. * Copright (C) 2014 Linaro Ltd.
  5. * Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. */
  12. #include "lib.h"
  13. UINT64
  14. LShiftU64 (
  15. IN UINT64 Operand,
  16. IN UINTN Count
  17. )
  18. // Left shift 64bit by 32bit and get a 64bit result
  19. {
  20. return Operand << Count;
  21. }
  22. UINT64
  23. RShiftU64 (
  24. IN UINT64 Operand,
  25. IN UINTN Count
  26. )
  27. // Right shift 64bit by 32bit and get a 64bit result
  28. {
  29. return Operand >> Count;
  30. }
  31. UINT64
  32. MultU64x32 (
  33. IN UINT64 Multiplicand,
  34. IN UINTN Multiplier
  35. )
  36. // Multiple 64bit by 32bit and get a 64bit result
  37. {
  38. return Multiplicand * Multiplier;
  39. }