This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics


On Thu, Jul 27, 2006 at 11:44:27AM +0200, Fran?ois-Xavier Coudert wrote:
> 
> All the new intrinsics come with testcases, and the patch is
> bootstrapped and regtested on i686-linux. I intend to commit it over
> the week-end unless someone objects, but I first have a question for
> our GMP experts (well, the pural is objectionable, is there anyone
> else that Steve who knows GMP well around here? :)

That not fair.  You knew I would go read the docs. :)

void mpz_mul_2exp (mpz_t ROP, mpz_t OP1, unsigned long int OP2)
     Set ROP to OP1 times 2 raised to OP2.  This operation can also be
     defined as a left shift by OP2 bits.

For positive N both `mpz_fdiv_q_2exp' and `mpz_tdiv_q_2exp' are
simple bitwise right shifts.  For negative N, `mpz_fdiv_q_2exp' is
effectively an arithmetic right shift treating N as twos complement
the same as the bitwise logical functions do, whereas
`mpz_tdiv_q_2exp' effectively treats N as sign and magnitude.


Of course, pointing out gmp functions exist and actually writing
the simplification routines are different.

> I believe the patch is otherwise simple and clean, except for the
> dirty library implementation on CHMOD, which currently forks, execs
> /bin/chmod and waits. It's not very clean, but it's protected by
> configure magic and writing (or importing) a parser of symbolic modes
> is just too much pain for me.

FreeBSD has a library routine named chmod().  I would
be surprised if other Unix-like OSs did not have a similar
library routine.



-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]