Skip to content

Commit

Permalink
Merge pull request #534 from NOAA-EMC/jw-upb8fix
Browse files Browse the repository at this point in the history
Jack Woollen's fix to optimize upb8.f routine
  • Loading branch information
jbathegit authored Nov 2, 2023
2 parents b36bac8 + aea7f4d commit 6a6bf38
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/upb8.f
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ subroutine upb8(nval,nbits,ibit,ibay)
!----------------------------------------------------------------------
!----------------------------------------------------------------------

if(nbits<0 ) call bort('BUFRLIB: UPB8 - nbits < zero !!!!!')
if(nbits>64) then
if(nbits<0) then
call bort('BUFRLIB: UPB8 - nbits < zero !!!!!')
elseif(nbits<=32) then
jbit=ibit; ival=0
call upb(ival,nbits,ibay,jbit)
nval=ival
elseif(nbits<=64) then
jbit=ibit; nvals=0
call upb(nvals(2),max(nbits-nbitw,0),ibay,jbit)
call upb(nvals(1),min(nbitw,nbits ),ibay,jbit)
nval=nval8
else
nval=0
return
endif

jbit=ibit
nvals=0
call upb(nvals(2),max(nbits-nbitw,0),ibay,jbit)
call upb(nvals(1),min(nbitw,nbits ),ibay,jbit)
nval=nval8

end subroutine

0 comments on commit 6a6bf38

Please sign in to comment.