ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rmatrix.c
(Generate patch)

Comparing ray/src/util/rmatrix.c (file contents):
Revision 2.94 by greg, Wed Apr 16 22:56:12 2025 UTC vs.
Revision 2.95 by greg, Thu Apr 17 15:54:36 2025 UTC

# Line 791 | Line 791 | rmx_transpose(RMATRIX *rm)
791   #define bmop(r,c, op)   (bmbyte(r,c) op bmbit(r,c))
792   #define bmtest(r,c)     bmop(r,c,&)
793   #define bmset(r,c)      bmop(r,c,|=)
794 #define bmtestandset(r,c)       (!bmtest(r,c) && bmset(r,c))
794                                          /* create completion bitmap */
795          bmap = (uby8 *)calloc(((size_t)rm->nrows*rm->ncols+7)>>3, 1);
796          if (!bmap)
# Line 803 | Line 802 | rmx_transpose(RMATRIX *rm)
802                  int     i0, j0;
803                  int     i1 = i;
804                  size_t  j1 = j;
805 <                if (!bmtestandset(i,j)) continue;
805 >                if (bmtest(i, j))
806 >                        continue;
807                  memcpy(val, rmx_val(rm,i,j),
808                          sizeof(rmx_dtype)*rm->ncomp);
809 +                bmset(i, j);
810                  for ( ; ; ) {           /* value transpose loop */
811                      const rmx_dtype     *ds;
812 <                    i0 = i1; j0 = (int)j1;
812 >                    i0 = i1; j0 = j1;
813                      ds = rmx_val(&dold, j0, i0);
814                      j1 = (ds - dold.mtx)/dold.ncomp;
815                      i1 = j1 / rm->ncols;
816                      j1 -= (size_t)i1*rm->ncols;
817 <                    if (!bmtestandset(i1,j1)) break;
817 >                    if ((i1 == i) & (j1 == j))
818 >                        break;          /* back to start */
819                      memcpy(rmx_lval(rm,i0,j0), ds,
820                                  sizeof(rmx_dtype)*rm->ncomp);
821 <                }
822 <                                        /* close the loop */
821 >                    bmset(i1, j1);
822 >                }                       /* complete the loop */
823                  memcpy(rmx_lval(rm,i0,j0), val,
824                          sizeof(rmx_dtype)*rm->ncomp);
825              }
# Line 828 | Line 830 | rmx_transpose(RMATRIX *rm)
830   #undef  bmop
831   #undef  bmtest
832   #undef  bmset
831 #undef  bmtestandset
833   }
834  
835   /* Multiply (concatenate) two matrices and allocate the result */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines