chiark
/
gitweb
/
~ian
/
moebius2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
keystrokes
[moebius2.git]
/
mgraph.c
1
/*
2
* Graph topology
3
*/
4
5
#include "mgraph.h"
6
7
static const unsigned dx[V6]= { +1, +1, 0, -1, -1, 0 },
8
dy[V6]= { 0, -Y1, -Y1, 0, +Y1, +Y1 };
9
10
int edge_end2(unsigned v1, int e) {
11
unsigned x, y;
12
13
y= (v1 & YMASK) + dy[e];
14
if (y & ~YMASK) return -1;
15
16
x= (v1 & XMASK) + dx[e];
17
if (x & ~XMASK) {
18
y= (Y-1)*Y1 - y;
19
x &= XMASK;;
20
}
21
return x | y;
22
}