diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 17:55:15 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 17:55:15 +0100 |
| commit | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (patch) | |
| tree | ecf89ef5fb2aa173119808e84e6d2e4cc15b962c /lib/packbits.f90 | |
Imported Upstream version 1.1.r3496upstream/1.1.r3496
Diffstat (limited to 'lib/packbits.f90')
| -rw-r--r-- | lib/packbits.f90 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/packbits.f90 b/lib/packbits.f90 new file mode 100644 index 00000000..88851866 --- /dev/null +++ b/lib/packbits.f90 @@ -0,0 +1,21 @@ +subroutine packbits(dbits,nsymd,m0,sym) + +! Pack 0s and 1s from dbits() into sym() with m0 bits per word. +! NB: nsymd is the number of packed output words. + + integer sym(nsymd) + integer*1 dbits(*) + + k=0 + do i=1,nsymd + n=0 + do j=1,m0 + k=k+1 + m=dbits(k) + n=ior(ishft(n,1),m) + enddo + sym(i)=n + enddo + + return +end subroutine packbits |
