Kernel Golf coming ...
Wycinek z pewnej dyskusji na LKML:
> > - printk("\n"); > > + if (space == 0) { > > + printk(" "); > > + space = 1; > > + } else { > > + printk("\n"); > > + space = 0; > > + } > > Why not: > > printk(space == 0 ? " " : "\n"); > space = !space;
Well, if I were going for _un_readability I'd have suggested: printk(space = !space ? " " : "\n");
Sure: if you use '\t' then you can do: printk("%c", 9+space++); space &= 1; No branches ;)
Please... char space = '\t'; [...] printk("%c", space); space = ('\t' + '\n') - space; Even fewer instructions and actually somewhat understandable
I see the days of kernelgolf coming...
Ale przecież kod jądra Linux jest czytelny ;)
Comments
Comments powered by Disqus