[gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics
François-Xavier Coudert
fxcoudert@gmail.com
Thu Jul 27 14:42:00 GMT 2006
- Previous message (by thread): [gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics
- Next message (by thread): [gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
> 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.
Hum, I'm not sure how we do this. So, if SHIFT >= 0, I << SHIFT is
done using mpz_mul_2exp and I >> SHIFT is done using mpz_fdiv_q_2exp,
right? What about negative shifts?
> Of course, pointing out gmp functions exist and actually writing
> the simplification routines are different.
Well, if an "algorithm" to relate << and >> to actualy GMP functions
is established, I'll be happy to write the code. I just don't know how
to handle all the cases.
> FreeBSD has a library routine named chmod(). I would
> be surprised if other Unix-like OSs did not have a similar
> library routine.
chmod() takes a mode_t argument, while the g77 CHMOD has to deal with
a string mode, which is a comma-separated list of octal or symbolic
modes, symbolic modes being of the form:
[ugoa...][[+-=][rwxXstugo...]...][,...]. Writing the parser to gives
the mode_t for a given mode string is not a simple task (the glibc
code for that is far from trivial), and I'd better not spend to much
energy on that.
FX
- Previous message (by thread): [gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics
- Next message (by thread): [gfortran,patch] Add ACCESS, CHMOD, GMTIME, LTIME, RSHIFT and LSHIFT g77 intrinsics
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Gcc-patches
mailing list