+#else*/
+ segment_t*s1l = s1->left;
+ segment_t*s1r = s1->right;
+ segment_t*s2l = s2->left;
+ segment_t*s2r = s2->right;
+ if(s1l) s1l->right = s2;
+ else a->list = s2;
+ s2->left = s1l;
+ if(s2r) s2r->left = s1;
+ s1->right = s2r;
+ if(s2l!=s1) s1->left = s2l;
+ else s1->left = s2;
+ if(s1r!=s2) s2->right = s1r;
+ else s2->right = s1;
+
+#ifdef SPLAY
+ if(s2->parent==s1) {
+ /*
+ s1 s2
+ / -> /
+ s2 s1
+ */
+ segment_t*l = s2->leftchild;
+ segment_t*r = s2->rightchild;
+ assert(s1->rightchild == s2); // because s1 < s2
+ segment_t*l1 = s1->leftchild;
+ segment_t*p = s1->parent;
+ s1->parent = s2;
+ s2->parent = p;
+ if(p) {
+ if(p->leftchild == s1) p->leftchild=s2;
+ else {assert(p->rightchild == s1);p->rightchild=s2;}
+ } else {
+ a->root = s2;
+ }
+ s2->leftchild = l1;
+ s2->rightchild = s1;
+ s1->leftchild = l;
+ s1->rightchild = r;
+ } else if(s1->parent==s2) {
+ /*
+ s2 s1
+ / -> /
+ s1 s2
+ */
+ segment_t*l = s1->leftchild;
+ segment_t*r = s1->rightchild;
+ segment_t*r2 = s2->rightchild;
+ assert(s2->leftchild == s1); // because s1 < s2
+ segment_t*p = s2->parent;
+ s2->parent = s1;
+ s1->parent = p;
+ if(p) {
+ if(p->leftchild == s2) p->leftchild=s1;
+ else {assert(p->rightchild == s2);p->rightchild=s1;}
+ } else {
+ a->root = s1;
+ }
+ s1->leftchild = s2;
+ s1->rightchild = r2;
+ s2->leftchild = l;
+ s2->rightchild = r;
+ } else {
+ segment_t*s1p = s1->parent;
+ segment_t*s1l = s1->leftchild;
+ segment_t*s1r = s1->rightchild;
+ segment_t*s2p = s2->parent;
+ segment_t*s2l = s2->leftchild;
+ segment_t*s2r = s2->rightchild;
+ s2->parent = s1p;
+ s2->leftchild = s1l;
+ s2->rightchild = s1r;
+ s1->parent = s2p;
+ s1->leftchild = s2l;
+ s1->rightchild = s2r;
+ assert(s1p || s2p);
+ if(s1p) {
+ if(s1p->leftchild == s1) s1p->leftchild=s2;
+ else {assert(s1p->rightchild == s1);s1p->rightchild=s2;}
+ } else {
+ a->root = s2;
+ }
+ if(s2p) {
+ if(s2p->leftchild == s2) s2p->leftchild=s1;
+ else {assert(s2p->rightchild == s2);s2p->rightchild=s1;}
+ } else {
+ a->root = s1;
+ }
+ }
+ if(s1->leftchild) s1->leftchild->parent = s1;
+ if(s2->leftchild) s2->leftchild->parent = s2;
+ if(s1->rightchild) s1->rightchild->parent = s1;
+ if(s2->rightchild) s2->rightchild->parent = s2;
+ if(!actlist_splay_verify(a)) {
+ actlist_splay_dump(a);
+ actlist_dump(a, s1->a.y);
+ }
+#endif
+
+//#endif