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.

85 lines
1.2 KiB

  1. #include "defs.h"
  2. transitive_closure(R, n)
  3. unsigned *R;
  4. int n;
  5. {
  6. register int rowsize;
  7. register unsigned i;
  8. register unsigned *rowj;
  9. register unsigned *rp;
  10. register unsigned *rend;
  11. register unsigned *ccol;
  12. register unsigned *relend;
  13. register unsigned *cword;
  14. register unsigned *rowi;
  15. rowsize = WORDSIZE(n);
  16. relend = R + n*rowsize;
  17. cword = R;
  18. i = 0;
  19. rowi = R;
  20. while (rowi < relend)
  21. {
  22. ccol = cword;
  23. rowj = R;
  24. while (rowj < relend)
  25. {
  26. if (*ccol & (1 << i))
  27. {
  28. rp = rowi;
  29. rend = rowj + rowsize;
  30. while (rowj < rend)
  31. *rowj++ |= *rp++;
  32. }
  33. else
  34. {
  35. rowj += rowsize;
  36. }
  37. ccol += rowsize;
  38. }
  39. if (++i >= BITS_PER_WORD)
  40. {
  41. i = 0;
  42. cword++;
  43. }
  44. rowi += rowsize;
  45. }
  46. }
  47. #if defined(KYLEP_CHANGE)
  48. void
  49. #endif
  50. reflexive_transitive_closure(R, n)
  51. unsigned *R;
  52. int n;
  53. {
  54. register int rowsize;
  55. register unsigned i;
  56. register unsigned *rp;
  57. register unsigned *relend;
  58. transitive_closure(R, n);
  59. rowsize = WORDSIZE(n);
  60. relend = R + n*rowsize;
  61. i = 0;
  62. rp = R;
  63. while (rp < relend)
  64. {
  65. *rp |= (1 << i);
  66. if (++i >= BITS_PER_WORD)
  67. {
  68. i = 0;
  69. rp++;
  70. }
  71. rp += rowsize;
  72. }
  73. }