Mercurial > projects > dwt2
diff org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d @ 113:fb3aa8075988
D2 support for the linux port.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 06 Apr 2011 21:57:23 +0200 |
parents | c01d033c633a |
children | 536e43f63c81 |
line wrap: on
line diff
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d Wed Mar 16 21:53:53 2011 +0900 +++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/PngChunk.d Wed Apr 06 21:57:23 2011 +0200 @@ -50,17 +50,24 @@ static /+const+/ byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; static /+const+/ byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; - static int[] CRC_TABLE; - //public static void static_this() { - static this() { - CRC_TABLE = new int[256]; + private static int[] _CRC_TABLE = null; + + static int[] CRC_TABLE () { + if (!_CRC_TABLE) + static_this; + + return _CRC_TABLE; + } + + private static void static_this () { + _CRC_TABLE = new int[256]; for (int i = 0; i < 256; i++) { - CRC_TABLE[i] = i; + _CRC_TABLE[i] = i; for (int j = 0; j < 8; j++) { - if ((CRC_TABLE[i] & 0x1) is 0) { - CRC_TABLE[i] = (CRC_TABLE[i] >> 1) & 0x7FFFFFFF; + if ((_CRC_TABLE[i] & 0x1) is 0) { + _CRC_TABLE[i] = (_CRC_TABLE[i] >> 1) & 0x7FFFFFFF; } else { - CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF); + _CRC_TABLE[i] = 0xEDB88320 ^ ((_CRC_TABLE[i] >> 1) & 0x7FFFFFFF); } } }