Barry Caplan wrote:
Who knew in this day and age flipping bits to change case is still publishable (this is from today!)
What I find a lot more objectionable is that what this code pretends to
do is not defined (in particular, the domain over which it applies).
Without such qualification,
> This is a simple example demonstrating my own personal method.
>
//to upper case
public char upper(int c)
{
return (char)((c >= 97 && c <=122) ? VisitSewers(c) : c);
}
static int VisitSewers(int c)
{
return AlligatorByte(c);
}
static int AlligatorByte(int c)
{
// R
Barry,
If you think that this is bad try 390 mainframe EBCDIC shift to upper case.
You can shift up to 256 characters at a time with a single machine language
instruction by ORing a line of spaces to your character field. Now that is
bit flipping and is still heavily used.
Carl
> -Original
3 matches
Mail list logo