Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
1.6 KiB

  1. title llshl - long shift left
  2. ;***
  3. ;llshl.asm - long shift left
  4. ;
  5. ; Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  6. ;
  7. ;Purpose:
  8. ; define long shift left routine (signed and unsigned are same)
  9. ; __allshl
  10. ;
  11. ;Revision History:
  12. ; 11-??-83 HS initial version
  13. ; 11-30-83 DFW added medium model support
  14. ; 03-12-84 DFW broke apart; added long model support
  15. ; 06-01-84 RN modified to use cmacros
  16. ; 11-28-89 GJF Fixed copyright
  17. ; 11-19-93 SMK Modified to work on 64 bit integers
  18. ; 01-17-94 GJF Minor changes to build with NT's masm386.
  19. ; 07-08-94 GJF Faster, fatter version for NT.
  20. ; 07-13-94 GJF Further improvements from JonM.
  21. ;
  22. ;*******************************************************************************
  23. .xlist
  24. include cruntime.inc
  25. include mm.inc
  26. .list
  27. ;***
  28. ;llshl - long shift left
  29. ;
  30. ;Purpose:
  31. ; Does a Long Shift Left (signed and unsigned are identical)
  32. ; Shifts a long left any number of bits.
  33. ;
  34. ;Entry:
  35. ; EDX:EAX - long value to be shifted
  36. ; CL - number of bits to shift by
  37. ;
  38. ;Exit:
  39. ; EDX:EAX - shifted value
  40. ;
  41. ;Uses:
  42. ; CL is destroyed.
  43. ;
  44. ;Exceptions:
  45. ;
  46. ;*******************************************************************************
  47. CODESEG
  48. _allshl PROC NEAR
  49. ;
  50. ; Handle shifts of 64 or more bits (all get 0)
  51. ;
  52. cmp cl, 64
  53. jae short RETZERO
  54. ;
  55. ; Handle shifts of between 0 and 31 bits
  56. ;
  57. cmp cl, 32
  58. jae short MORE32
  59. shld edx,eax,cl
  60. shl eax,cl
  61. ret
  62. ;
  63. ; Handle shifts of between 32 and 63 bits
  64. ;
  65. MORE32:
  66. mov edx,eax
  67. xor eax,eax
  68. and cl,31
  69. shl edx,cl
  70. ret
  71. ;
  72. ; return 0 in edx:eax
  73. ;
  74. RETZERO:
  75. xor eax,eax
  76. xor edx,edx
  77. ret
  78. _allshl ENDP
  79. end