[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

tolower trick in net.c



Hi Everyone,

I was looking at
https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/xen/net.c. The
tolower trick of setting the 5th bit is not portable. C does not
guarantee the trick.

    for (number = 0, c = *cp | 0x20; ... )

As far as I know the only guarantees are:

* letters A-Z and a-z exist and that they fit within a byte
* digits 0-9 are sequential

It may be a good idea to just call tolower on *cp.

Jeff


Reply to: