From 3d0f3f38d9d8345b6508b3289dc94b0500c53d9e Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 14 Nov 2026 12:41:16 -0800 Subject: Breakout, Clock demos Math lib with simple constants raw bit converters TypeConAry unified Big Formatting change Debug symbols for constant data IterPeeps was endlessly running asserts with much inlining RegAlloc rounds raised --- chapter31/docs/examples/Dijkstra.smp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'chapter31/docs/examples/Dijkstra.smp') diff --git a/chapter31/docs/examples/Dijkstra.smp b/chapter31/docs/examples/Dijkstra.smp index a8fcf3da..6591b310 100644 --- a/chapter31/docs/examples/Dijkstra.smp +++ b/chapter31/docs/examples/Dijkstra.smp @@ -6,14 +6,14 @@ val shortestPath = { !sys.aryi64 matrix, int nodes, int src, int dst -> i64 infinity = sys.integer.MAX_I64; var visited = new sys.adt.bitset(); // All nodes are infinitely far from each other, except the starting point - var dist = new i64[nodes]{ int i -> i==src ? 0 : infinity; }; + var dist = new i64[nodes]{ int i -> i == src ? 0 : infinity; }; i64 result = -1; int count = 0; while( count < nodes && result < 0 ) { int nearest = -1; i64 best = infinity; - for( int node=0; node else { if( nearest == dst ) return best; visited.set(nearest); - for( int node=0; node 0 && !visited.get(node) && best+weight < dist[node] ) dist[node] = best+weight; @@ -47,7 +47,7 @@ val main = { u8[~][] args -> if( !matrix ) return usage(); if( !matrix.len ) return usage(); // All numbers are positive - for( u32 i=0; i if( src < 0 || src >= nodes || dst < 0 || dst >= nodes ) return usage(); // Source and destination land within the graph - int source=src, destination=dst; + int source = src, destination = dst; i64 cost = shortestPath(matrix,nodes,source,destination); if( cost >= 0 ) { new sys.aryu8().num(cost).add('\n').write(1); -- cgit v1.2.3