maarten van damme:

http://dpaste.dzfl.pl/8a2aef5b

Some suggestions about the code:
- Put a space before and after operators, after a commas and semicolon, around "..", etc.
- Compile with "-wi -property";
- Try to add pure/const/nothrow/immutable where possible;
- Minimize the need of cast();
- Sometimes it's useful to localize the imports (stdio e datetime are used just by the main); - Minimize the usage of magical constants like 0b10_0000_0000, possibly define it only once. And often adding underscores inside long numbers is handy (here I have put them every 4 digits because it's binary); - Repeating things like "short[81]" in many function signatures is quite bad. Better to define a global type with alias (or someday better with std.typecons.Typedef when it will work), and then use it;
- Generally it's better to use unsigned values for array indexes;
- If you look for performance and your program is single thread, then it's better to annotate global variables with __gshared;

- This:
    ubyte[81] taken = false;
is better than this:
    ubyte[81] taken;
    taken[] = false;


This is your code modified, it's also a little faster:
http://dpaste.dzfl.pl/06510dcd

I will try to replace the int[] of cachedBitsetToRange with something more static, to reduce indirection.

Bye,
bearophile

Reply via email to