summaryrefslogtreecommitdiff
path: root/lib/77bit
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
committerChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
commitde18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch)
treef517074cd603d30eb7ba7e2122d38051e4c1439c /lib/77bit
parentb76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff)
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg' with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
Diffstat (limited to 'lib/77bit')
-rw-r--r--lib/77bit/packjt77.f9066
1 files changed, 55 insertions, 11 deletions
diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90
index 35236b37..eab4ff6c 100644
--- a/lib/77bit/packjt77.f90
+++ b/lib/77bit/packjt77.f90
@@ -90,22 +90,63 @@ end subroutine hash22
integer function ihashcall(c0,m)
+ implicit none
- integer*8 n8
- character*13 c0
+ character(len=13), intent(in) :: c0
+ integer, intent(in) :: m
+ integer(kind=8) :: n8
+ integer :: i,j
character*38 c
data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
- n8=0
+ n8=0_8
do i=1,11
j=index(c,c0(i:i)) - 1
- n8=38*n8 + j
+ n8=38_8*n8 + j
enddo
- ihashcall=ishft(47055833459_8*n8,m-64)
+
+ ihashcall=ihashcall_from_n8(n8,m)
return
end function ihashcall
+integer function ihashcall_from_n8(n8,m)
+ implicit none
+
+ integer(kind=8), intent(in) :: n8
+ integer, intent(in) :: m
+ integer(kind=8), parameter :: hash_factor(0:3) = (/2419_8, 62655_8, 10_8, 0_8/)
+ integer(kind=8) :: b(0:3), p(0:3)
+ integer(kind=8) :: carry, term
+ integer(kind=8) :: x
+ integer :: i,j
+
+ x=n8
+ do i=0,3
+ b(i)=mod(x,65536_8)
+ x=x/65536_8
+ enddo
+
+ ! Return the top m bits of the low 64 bits of 47055833459*n8.
+ carry=0_8
+ do i=0,3
+ term=carry
+ do j=0,i
+ term=term+hash_factor(j)*b(i-j)
+ enddo
+ p(i)=mod(term,65536_8)
+ carry=term/65536_8
+ enddo
+
+ if(m.le.16) then
+ ihashcall_from_n8=int(p(3)/(2_8**(16-m)))
+ else
+ ihashcall_from_n8=int(p(3)*(2_8**(m-16)) + p(2)/(2_8**(32-m)))
+ endif
+
+ return
+end function ihashcall_from_n8
+
subroutine save_hash_call(c13,n10,n12,n22)
character*13 c13,cw
@@ -1765,18 +1806,21 @@ subroutine hash22var(n22,c13,nthr)
end subroutine hash22var
integer function ihashcallvar(c0,m)
+ implicit none
- integer*8 n8
- character*13 c0
- character*38 c
+ character(len=13), intent(in) :: c0
+ integer, intent(in) :: m
+ integer(kind=8) :: n8
+ integer :: i,j
+ character*38 :: c
data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
- n8=0
+ n8=0_8
do i=1,11
j=index(c,c0(i:i)) - 1
- n8=38*n8 + j
+ n8=38_8*n8 + j
enddo
- ihashcallvar=ishft(47055833459_8*n8,m-64)
+ ihashcallvar=ihashcall_from_n8(n8,m)
return
end function ihashcallvar