Silverfrost Forums

Welcome to our forums

shiftr and shiftl

2 Jan 2025 2:39 #31785

Please consider adding shiftr and shiftl to the wish list.

I had to resort to adding a ftn95 specific module in order to compile and run a much larger program with ftn95

Thanks

Ken

winapp

module shift_ftn95_mod
implicit none
contains

  integer function shiftr(i,n)
  integer, intent(in) :: i, n
    shiftr = ishft(i,-n)    
  end function shiftr

  integer function shiftl(i,n)
  integer, intent(in) :: i, n
    shiftl = ishft(i,n)
  end function shiftl
  
end module shift_ftn95_mod

program int_div_mult_by_2
use iso_fortran_env
use shift_ftn95_mod    ! Required with FTN95
implicit none
integer i, j
write(*,'(a,/)') compiler_version()
i = 3                       ! i = 3, j = 2
j = 2
print*, i/j                 ! i/j   = 1
print*, ishft(i,-1)         ! i / 2 = 1
print*, shiftr(i,1)         ! i / 2 = 1
print*, i*j                 ! i x j = 6
print*, shiftl(i,1)         ! i x 2 = 6
i = 4
print*                      ! i = 4, j = 2
print*, i/j                 ! i/j   = 2
print*, ishft(i,-1)         ! i / 2 = 2
print*, shiftr(i,1)         ! i / 2 = 2
print*, i*j                 ! i x j = 8
print*, shiftl(i,1)         ! i x 2 = 8
end program int_div_mult_by_2



FTN95 v9.04.0

            1
            1
            1
            6
            6

            2
            2
            2
            8
            8
3 Jan 2025 8:12 #31788

Thanks Ken. I will add these to the task list.

7 Jan 2025 3:00 #31799

shiftl,shiftr and shifta have now been added for Win32 and x64.

These will be in the next release of FTN95 and the associated DLLs.

16 Nov 2025 11:12 (Edited: 18 Nov 2025 6:00) #32478

Paul, the new intrinsics SHIFTL and SHIFTR in Version 9.10 work with /x64, but fail in 32-bit EXEs. The problem is not present in Version 9.14

   program tst
   implicit none
   print *,shiftr(16,2),shiftl(4,3)
   end program tst

The 32-bit EXE causes a pop up saying that the entry point SHIFTR# could not be found in the EXE.

Your post https://forums.silverfrost.com/Forum/Topic/4513 said that it would be part of the current release: Version: 9.10.0.0 Built: Sat Feb 8 11:13:50 2025

16 Nov 2025 11:29 #32479

Paul, I took Bill's source code and removed the lines for the module, leaving me a small source file, with invocations of SHIFTR and SHIFTL, which should be available in the current version of FTN95. The code compiles and links. The 64 bit EXE works, but the 32-bit EXE pops up a message that the entry point JSHIFTL# is missing (from the Silverfrost support DLLS where they are expected to be available).

16 Nov 2025 1:02 #32480

mecej4

This might be a fault at our end or you might be accessing an old salflibc.dll.

The latest DLLs are available here ...https://forums.silverfrost.com/Forum/Topic/3780

18 Nov 2025 6:09 #32489

Thanks, Paul. Updating to the latest DLLs fixed the problem.

Please login to reply.