Index: ram/wdfield.c
===================================================================
--- ram/wdfield.c	(revision b9ddc9a0108506d3ed9d8efc2e18323ab7dff101)
+++ ram/wdfield.c	(revision 10c7b465675bfa714c3f13edc06160bed081e415)
@@ -112,6 +112,6 @@
 	/* make endpoints track */
 
-	*(wsp1 - 1) = *(wsp2 - 1);			/* lowest point */
-	*(wsp1 + NUMWPNT) = *(wsp2 + NUMWPNT - 1);	/* highest point */
+	*(wsp1 - 1) = (uint16_t)*(wsp2 - 1);			/* lowest point */
+	*(wsp1 + NUMWPNT) = (uint16_t)*(wsp2 + NUMWPNT - 1);	/* highest point */
 
 #if	DOUBLED
@@ -121,6 +121,6 @@
 	memcpyw(wsp1, wsp2, NUMWPNT);
 
-	*(wsp1 - 1) = *(wsp2 - 1);			/* lowest point */
-	*(wsp1 + NUMWPNT) = *(wsp2 + NUMWPNT - 1);	/* highest point */
+	*(wsp1 - 1) = (uint16_t)*(wsp2 - 1);			/* lowest point */
+	*(wsp1 + NUMWPNT) = (uint16_t)*(wsp2 + NUMWPNT - 1);	/* highest point */
 #endif
 
@@ -221,5 +221,5 @@
 
 				tv = (ov[j] >> 5) -
-					((((long)curdif * wdcurtb[k])
+					(int16_t)((((int32_t)curdif * (int32_t)wdcurtb[k])
 					  + WCROUND) / WCSCALE);
 
@@ -237,5 +237,5 @@
 
 				tv = (ov[j] >> 5) -
-					((((long)curdif * wdcurtb[k])
+					(int16_t)((((int32_t)curdif * (int32_t)wdcurtb[k])
 					  + WCROUND) / WCSCALE);
 
