Am 29.03.2013 14:42, schrieb Thomas Koenig:
I wrote:
PS: Regarding the string comparison patch: As Janne, think it should be
fine with also supporting kind=4 (don't forget to multiply the
length by
the kind, e.g. ts.kind or more properly (but equivalently)
gfc_character_kinds[<index>].bit_size/BITS_PER_BYTE).
I'll do that.
Oops, it turns out we can't do this, at least not on little-endian
systems.
I somehow completely missed that "<" is permitted for characters.*
Thanks for the reminder. Actually, we still can do use memcpy for "=="
and "/=" - but admittedly not for <, <=, >= and >=.
Thus, how about using memcmp for kind=4 for == and /= only - and for
kind=1 also for <, > etc.?
Side note: The elemental intrinsic functions lge, lgt, lle and llt work
likewise. Thus, they could also profit from the same optimization.
However, I do not know whether anyone one uses these. The difference
between "<" and llt() seems to be that llt takes a default-kind (or
F2008: also ASCII kind) and uses the ASCII collating sequence while <
etc use the collating sequence. As our default-kind character is the
ASCII character, the distinction does not matter.
Tobias
* For <, >= etc., see Fortran 2003, "7.2.3 Relational intrinsic
operations", 7th paragraph; Fortran 2008, 9th paragraph of "7.1.5.5.1
Interpretation of relational intrinsic operations"