From: Shawn O. Pearce Date: Thu, 25 Dec 2008 02:10:58 GMT Subject: [JGIT PATCH 02/23] Add MutableObjectId.clear() to set the id to zeroId Message-ID: <1230171079-17156-3-git-send-email-spearce@spearce.org> In-Reply-To: <1230171079-17156-2-git-send-email-spearce@spearce.org> This makes it easier to set any MutableObjectId to the same value as the zeroId. Its logical to ask for a ".clear()" invocation when you are writing application code, and its more efficient for the JIT if we do 5 zero writes then to perform a copy from the zeroId singleton. Signed-off-by: Shawn O. Pearce --- .../src/org/spearce/jgit/lib/MutableObjectId.java | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java index 5b16345..fadebab 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/MutableObjectId.java @@ -66,6 +66,15 @@ MutableObjectId(MutableObjectId src) { this.w5 = src.w5; } + /** Make this id match {@link ObjectId#zeroId()}. */ + public void clear() { + w1 = 0; + w2 = 0; + w3 = 0; + w4 = 0; + w5 = 0; + } + /** * Convert an ObjectId from raw binary representation. * -- 1.6.1.rc4.301.g5497a