D Paste by downs
Description: insanity
Hide line numbers

Create new paste
Post a reply
View replies

Paste:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
module test136;

import std.md5, std.stdio;

extern(C) void exit(int);

void processSection(ubyte sect) {
  ubyte[16] temp;
  temp[15] = sect;
  void inc() {
    for (int i = 0; i < 15; ++i) {
      temp[i] ++;
      if (temp[i]) return;
    }
  }
  while (true) {
    ubyte[16] res = void;
    sum(res, temp);
    if (res == temp) { writefln(res); exit(0); }
    inc;
    if (!temp[0] && !temp[1] && !temp[2]) writefln("Current: ", temp);
  }
}

// use tools for threading
import tools.threadpool, tools.base;
void main() {
  auto tp = new Threadpool(4);
  for (int i = 0; i < 256; ++i)
    tp.addTask(cast(ubyte) i /apply/ &processSection);
  while (true) tp.idle();
}

Replies:
No replies posted yet