{
  "WorkItem": {
    "AffectedComponent": {
      "Name": "",
      "DisplayName": ""
    },
    "ClosedComment": "fixed in changeset 32282.",
    "ClosedDate": "2009-06-02T08:48:45.877-07:00",
    "CommentCount": 0,
    "Custom": null,
    "Description": "I suggest that you replace the SharedUtils.URShift functions (in the ZLib library, ZLib.cs file) with the following:\n \npublic static int URShift(int number, int bits)\n{\nreturn (int)((uint)number >> bits);\n}\npublic static long URShift(long number, int bits)\n{\nreturn (long)((ulong)number >> bits);\n}\n \nNote that other two versions of the function are unused, and can be deleted, as SharedUtils is an internal class.\n \nTest code for above optimization (int version, but I tested long too):\n \n        static void Main(string[] args)\n        {\n            int i = -1;\n            Console.WriteLine(\"Original value: \" + i.ToString(\"X\"));\n            Console.WriteLine(\"Signed shift right: \" + (i >> 5).ToString(\"X\"));\n            Console.WriteLine(\"Old Unsigned shift right: \" + OldURShift(i, 5).ToString(\"X\"));\n            Console.WriteLine(\"New Unsigned shift right: \" + NewURShift(i, 5).ToString(\"X\"));\n            Console.WriteLine();\n            i = 65534;\n            Console.WriteLine(\"Original value: \" + i.ToString(\"X\"));\n            Console.WriteLine(\"Signed shift right: \" + (i >> 5).ToString(\"X\"));\n            Console.WriteLine(\"Old Unsigned shift right: \" + OldURShift(i, 5).ToString(\"X\"));\n            Console.WriteLine(\"New Unsigned shift right: \" + NewURShift(i, 5).ToString(\"X\"));\n            Console.ReadLine();\n        }\n        static int NewURShift(int number, int bits)\n        {\n            return (int)((uint)number >> bits);\n        }\n        static int OldURShift(int number, int bits)\n        {\n            if (number >= 0)\n                return number >> bits;\n            else\n                return (number >> bits) + (2 << ~bits);\n        }\n \nThanks,\nShane",
    "LastUpdatedDate": "2013-05-16T05:32:20.8-07:00",
    "PlannedForRelease": "",
    "ReleaseVisibleToPublic": false,
    "Priority": {
      "Name": "Low",
      "Severity": 50,
      "Id": 1
    },
    "ProjectName": "DotNetZip",
    "ReportedDate": "2009-05-28T20:15:46.683-07:00",
    "Status": {
      "Name": "Closed",
      "Id": 4
    },
    "ReasonClosed": {
      "Name": "Unassigned"
    },
    "Summary": "Optimized SharedUtils.URShift code",
    "Type": {
      "Name": "Issue",
      "Id": 3
    },
    "VoteCount": 1,
    "Id": 7823
  },
  "FileAttachments": [],
  "Comments": [
    {
      "Message": "By the way, I didn't test the code on the compact framework (or silverlight or etc), but I doubt there's any difference.  I was surprised that the code did not have to be placed in an 'unchecked' block to work, although I don't code in C# often.  It should make a slight speed difference, though, especially if this code block is used often during the compression.  I'm not sure if it is or not, but there's a couple dozen references to it throughout the code.",
      "PostedDate": "2009-05-29T12:42:46.86-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2009-06-02T08:48:45.877-07:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-02-21T18:44:17.433-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-05-16T05:32:20.8-07:00",
      "Id": -2147483648
    }
  ]
}