MathLShiftS64.c 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /** @file
  2. 64-bit Math Worker Function.
  3. The 32-bit versions of C compiler generate calls to library routines
  4. to handle 64-bit math. These functions use non-standard calling conventions.
  5. Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. /*
  9. * Shifts a 64-bit signed value left by a particular number of bits.
  10. */
  11. __declspec(naked) void __cdecl _allshl (void)
  12. {
  13. _asm {
  14. ;
  15. ; Handle shifting of 64 or more bits (return 0)
  16. ;
  17. cmp cl, 64
  18. jae short ReturnZero
  19. ;
  20. ; Handle shifting of between 0 and 31 bits
  21. ;
  22. cmp cl, 32
  23. jae short More32
  24. shld edx, eax, cl
  25. shl eax, cl
  26. ret
  27. ;
  28. ; Handle shifting of between 32 and 63 bits
  29. ;
  30. More32:
  31. mov edx, eax
  32. xor eax, eax
  33. and cl, 31
  34. shl edx, cl
  35. ret
  36. ReturnZero:
  37. xor eax,eax
  38. xor edx,edx
  39. ret
  40. }
  41. }