1: /* function iputbt fortran callable for integer*4. PLW 8/5/79*/ 2: /* For integer x, replace the n bits starting at bit p with v. 3: The rightmost or lowest bit is number 0 and integers are 31 4: bits plus the sign bit. The n bits are counted from lowest 5: to highest. */ 6: 7: long int i_putbit(x,p,n,v) 8: long int *x,*p,*n,*v; 9: { 10: long int r; 11: if (*n == 32) r=~0; 12: else r=~(~0 << *n); 13: return(((r & *v) << *p) | (~(r<< *p) & *x)); 14: }