ChkCards.e 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #include <m2_traps.h>
  2. ;
  3. ; (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. ; See the copyright notice in the ACK home directory, in the file "Copyright".
  5. ;
  6. ;
  7. ; Module: CARDINAL operations with overflow checking
  8. ; Author: Ceriel J.H. Jacobs
  9. ; Version: $Header$
  10. ;
  11. mes 2,EM_WSIZE,EM_PSIZE
  12. exp $addu
  13. exp $subu
  14. exp $mulu
  15. #if EM_WSIZE < EM_LSIZE
  16. exp $addul
  17. exp $subul
  18. exp $mulul
  19. #endif
  20. pro $addu,0
  21. loc -1
  22. lol 0
  23. sbu EM_WSIZE
  24. lol EM_WSIZE
  25. cmu EM_WSIZE
  26. zge *1
  27. loc M2_UOVFL
  28. trp
  29. 1
  30. lol 0
  31. lol EM_WSIZE
  32. adu EM_WSIZE
  33. stl EM_WSIZE
  34. ret 0
  35. end 0
  36. #if EM_WSIZE < EM_LSIZE
  37. pro $addul,0
  38. ldc -1
  39. ldl 0
  40. sbu EM_LSIZE
  41. ldl EM_LSIZE
  42. cmu EM_LSIZE
  43. zge *1
  44. loc M2_UOVFL
  45. trp
  46. 1
  47. ldl 0
  48. ldl EM_LSIZE
  49. adu EM_LSIZE
  50. sdl EM_LSIZE
  51. ret 0
  52. end 0
  53. #endif
  54. pro $mulu,0
  55. lol 0
  56. zeq *1
  57. loc -1
  58. lol 0
  59. dvu EM_WSIZE
  60. lol EM_WSIZE
  61. cmu EM_WSIZE
  62. zge *1
  63. loc M2_UOVFL
  64. trp
  65. 1
  66. lol 0
  67. lol EM_WSIZE
  68. mlu EM_WSIZE
  69. stl EM_WSIZE
  70. ret 0
  71. end 0
  72. #if EM_WSIZE < EM_LSIZE
  73. pro $mulul,0
  74. ldl 0
  75. ldc 0
  76. cmu EM_LSIZE
  77. zeq *1
  78. ldc -1
  79. ldl 0
  80. dvu EM_LSIZE
  81. ldl EM_LSIZE
  82. cmu EM_LSIZE
  83. zge *1
  84. loc M2_UOVFL
  85. trp
  86. 1
  87. ldl 0
  88. ldl EM_LSIZE
  89. mlu EM_LSIZE
  90. sdl EM_LSIZE
  91. ret 0
  92. end 0
  93. #endif
  94. pro $subu,0
  95. lol EM_WSIZE
  96. lol 0
  97. cmu EM_WSIZE
  98. zge *1
  99. loc M2_UUVFL
  100. trp
  101. 1
  102. lol EM_WSIZE
  103. lol 0
  104. sbu EM_WSIZE
  105. stl EM_WSIZE
  106. ret 0
  107. end 0
  108. #if EM_WSIZE < EM_LSIZE
  109. pro $subul,0
  110. ldl EM_LSIZE
  111. ldl 0
  112. cmu EM_LSIZE
  113. zge *1
  114. loc M2_UUVFL
  115. trp
  116. 1
  117. ldl EM_LSIZE
  118. ldl 0
  119. sbu EM_LSIZE
  120. sdl EM_LSIZE
  121. ret 0
  122. end 0
  123. #endif