Leaked source code of windows server 2003
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.

72 lines
1.8 KiB

  1. /***
  2. *convert.cpp - RTC support
  3. *
  4. * Copyright (c) 1998-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *
  7. *Revision History:
  8. * 07-28-98 JWM Module incorporated into CRTs (from KFrei)
  9. * 11-03-98 KBF Moved pragma optimize to rtcpriv header
  10. * 05-11-99 KBF Error if RTC support define not enabled
  11. *
  12. ****/
  13. #ifndef _RTC
  14. #error RunTime Check support not enabled!
  15. #endif
  16. #include "rtcpriv.h"
  17. char __fastcall
  18. _RTC_Check_2_to_1(short big)
  19. {
  20. unsigned bits = big & 0xFF00;
  21. if (bits && bits != 0xFF00)
  22. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  23. return (char)big;
  24. }
  25. char __fastcall
  26. _RTC_Check_4_to_1(int big)
  27. {
  28. unsigned int bits = big & 0xFFFFFF00;
  29. if (bits && bits != 0xFFFFFF00)
  30. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  31. return (char)big;
  32. }
  33. char __fastcall
  34. _RTC_Check_8_to_1(__int64 big)
  35. {
  36. unsigned __int64 bits = big & 0xFFFFFFFFFFFFFF00;
  37. if (bits && bits != 0xFFFFFFFFFFFFFF00)
  38. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  39. return (char)big;
  40. }
  41. short __fastcall
  42. _RTC_Check_4_to_2(int big)
  43. {
  44. unsigned int bits = big & 0xFFFF0000;
  45. if (bits && bits != 0xFFFF0000)
  46. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  47. return (short)big;
  48. }
  49. short __fastcall
  50. _RTC_Check_8_to_2(__int64 big)
  51. {
  52. unsigned __int64 bits = big & 0xFFFFFFFFFFFF0000;
  53. if (bits && bits != 0xFFFFFFFFFFFF0000)
  54. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  55. return (short)big;
  56. }
  57. int __fastcall
  58. _RTC_Check_8_to_4(__int64 big)
  59. {
  60. unsigned __int64 bits = big & 0xFFFFFFFF00000000;
  61. if (bits && bits != 0xFFFFFFFF00000000)
  62. _RTC_Failure(_ReturnAddress(), _RTC_CVRT_LOSS_INFO);
  63. return (int)big;
  64. }