{"content":{"sharePage":{"page":0,"digests":[{"id":"11449287","dateCreated":"1240620266","smartDate":"Apr 24, 2009","userCreated":{"username":"Edmund_Moshammer","url":"https:\/\/www.wikispaces.com\/user\/view\/Edmund_Moshammer","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"},"monitored":false,"locked":false,"links":{"self":"https:\/\/chessprogramming.wikispaces.com\/share\/view\/11449287"},"dateDigested":1531478011,"startDate":null,"sharedType":"discussion","title":"Optimisation","description":"I would propose the following modifications. I got rid of the temp and the number of instructions is reduced.
\n
\nint allShortestPaths(U64 sq1, U64 sq2, U64 path, U64 * asp) {
\n int i;
\n asp[0] = sq1;
\n
\n for (i=0; !(asp[i] & sq2); i++) {
\n if (asp[i+1] = (mgen_fill_KING(asp[i]) & path) & ~asp[i]) return 0;
\n }
\n
\n int length = i;
\n asp[i] = sq2;
\n
\n for (;i;i--) asp[i-1] &= mgen_fill_KING(asp[i]) & path;
\n
\n return length;
\n}","replyPages":[{"page":0,"digests":[{"id":"11449431","body":"I missed to negate the return 0 condition. Furthermore one can even leave the ~asp[i] away in the same line.
\n
\nif (!(asp[i+1] = mgen_fill_KING(asp[i]) & path)) return 0;","dateCreated":"1240621035","smartDate":"Apr 24, 2009","userCreated":{"username":"Edmund_Moshammer","url":"https:\/\/www.wikispaces.com\/user\/view\/Edmund_Moshammer","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"}},{"id":"11452745","body":"great, lets put it as an optimized version beside Steffan's original code.","dateCreated":"1240646838","smartDate":"Apr 25, 2009","userCreated":{"username":"GerdIsenberg","url":"https:\/\/www.wikispaces.com\/user\/view\/GerdIsenberg","imageUrl":"https:\/\/www.wikispaces.com\/user\/pic\/1202793136\/GerdIsenberg-lg.jpg"}},{"id":"11452877","body":"I actually miss the condition the flood does not grow anymore.","dateCreated":"1240650115","smartDate":"Apr 25, 2009","userCreated":{"username":"GerdIsenberg","url":"https:\/\/www.wikispaces.com\/user\/view\/GerdIsenberg","imageUrl":"https:\/\/www.wikispaces.com\/user\/pic\/1202793136\/GerdIsenberg-lg.jpg"}},{"id":"11452947","body":"You are right, I forgot about that purpose of ~asp[i] when writing "Furthermore one can even leave the ~asp[i] away in the same line."
\n
\nwith ~asp[i] you have the "no-grow" condition in place.
\nie if (!(asp[i+1] & ~asp[i])) return 0;","dateCreated":"1240653145","smartDate":"Apr 25, 2009","userCreated":{"username":"Edmund_Moshammer","url":"https:\/\/www.wikispaces.com\/user\/view\/Edmund_Moshammer","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"}}],"more":0}]}],"more":false},"comments":[]},"http":{"code":200,"status":"OK"},"redirectUrl":null,"javascript":null,"notices":{"warning":[],"error":[],"info":[],"success":[]}}