diff src/org/tmatesoft/hg/internal/Internals.java @ 420:6c22bdc0bdfd

Respect long offsets in revlogs
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 22:56:01 +0100
parents 7f136a3fa671
children fdd7d756dea0
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java	Thu Mar 22 21:36:41 2012 +0100
+++ b/src/org/tmatesoft/hg/internal/Internals.java	Thu Mar 22 22:56:01 2012 +0100
@@ -394,4 +394,15 @@
 		}
 		return sb;
 	}
+	
+	/**
+	 * keep an eye on all long to int downcasts to get a chance notice the lost of data
+	 * Use if there's even subtle chance there might be loss
+	 * (ok not to use if there's no way for l to be greater than int) 
+	 */
+	public static int ltoi(long l) {
+		int i = (int) l;
+		assert ((long) i) == l : "Loss of data!";
+		return i;
+	}
 }