From c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 Mon Sep 17 00:00:00 2001 From: "Iain R. Learmonth" Date: Sun, 18 Oct 2015 17:55:15 +0100 Subject: Imported Upstream version 1.1.r3496 --- lib/packbits.f90 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/packbits.f90 (limited to 'lib/packbits.f90') 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 -- cgit v1.2.3