{ "info": { "author": "Robert Xiao", "author_email": "robert.bo.xiao@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Utilities" ], "description": "=====================================\nfixedint: simple fixed-width integers\n=====================================\n\nThis module provides fixed-size integer classes which retain their fixed nature across\narithmetic operations. It is geared towards users who need to emulate machine integers.\n\nIt provides flexible classes for defining integers with a fixed number of bits, as well\nas predefined classes for common machine integer sizes. These classes can be used as\ndrop-in replacements for int/long, and can be sliced to extract bitfields.\n\nMutable versions of these integers are provided, enabling usages such as emulation of\nmachine registers.\n\n\n\nBasic Usage\n===========\n\nA collection of predefined fixed-width integers for widths 8, 16, 32 and 64 are available\nin signed and unsigned varieties. Mutable and immutable versions of each type are provided.\n\nThese are named as ``[Mutable][U]Int``, e.g. ``UInt64`` or ``MutableInt8``. Use these\nclasses as you would ``int``; arithmetic operations involving these classes will preserve\nfixed width. For example::\n\n x = UInt32(0)\n print(hex(~x)) # prints 0xffffffff\n\nMutable instances can be modified in-place, preserving their type::\n\n x = MutableUInt32(0)\n y = x\n x += 100\n print(y) # prints 100\n\nTo set a mutable integer without losing its type, use slicing::\n\n x = MutableUInt32(0)\n x[:] = -1\n print(hex(x)) # prints 0xffffffff\n\n\nArithmetic Operations\n=====================\n\n``FixedInt`` instances support all arithmetic operators. For binary operators, both\noperands are converted to plain Python ``int`` and then operated on. With a few\nexceptions, the result will be cast back to a ``FixedInt`` large enough to hold either\noperand, provided one of the operands was a ``FixedInt``. Note that the resulting\n``FixedInt`` may not be large enough to hold the complete result, in which case the\nresult will be truncated.\n\nThe exceptions are as follows:\n\n* ``divmod`` returns a tuple of plain ``int`` s\n* true division returns a float\n* ``**``, ``<<`` and ``>>`` will return a ``FixedInt`` if the left operand was a\n ``FixedInt``, and plain ``int`` otherwise.\n\nMutable instances additionally support in-place operations, which will modify the\nvalue without altering its type.\n\n\nArithmetic operations between two integers of different sizes follow C integer promotion\nrules when determining the type of the final result. These rules boil down to the\nfollowing:\n\n* If the operands are both signed, or both unsigned, the wider of the two operand types is chosen.\n* Otherwise, if the unsigned operand is wider, the unsigned operand is chosen.\n* Otherwise, the signed operand is chosen.\n\n\n\n\nSlicing\n=======\n\n``FixedInt`` instances support slicing. Slicing with a single integer produces a single\nBoolean value representing the bit at that position. Slicing with a range produces a\n``FixedInt`` containing the range of bits. Mutable instances additionally support slice\nassignment. This makes e.g. manipulating a flag register straightforward, without needing\nto use bitwise operations.\n\nAll indexing operations treat the least-significant bit (LSB) as bit 0. Currently, only\ncontiguous bit sections can be obtained; for more flexibility consider using a module\nsuch as `bitarray`.\n\nGetting a slice results in a ``FixedInt`` instance with exactly as many bits as the range.\nThis can be used to perform wraparound arithmetic on a bit field.\n\nSlices support two main syntaxes::\n\n value[:]\n value[:j]\n\nThe latter syntax is more convenient when dealing with fixed-width fields. Both of the\nslice arguments may be omitted, in which case they will default to the LSB and MSB of\nthe ``FixedInt`` respectively.\n\n\n\nByte Conversion\n===============\n\n``FixedInt`` instances can be converted to and from raw byte representations by using the\n``.to_bytes`` instance method and the ``.from_bytes`` classmethod. The usage of these\nmethods matches that of Python 3.4's ``int.to_bytes`` and ``int.from_bytes`` methods.\n\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nneonneo/fixedint", "keywords": "", "license": "PSF", "maintainer": "", "maintainer_email": "", "name": "fixedint", "package_url": "https://pypi.org/project/fixedint/", "platform": "", "project_url": "https://pypi.org/project/fixedint/", "project_urls": { "Homepage": "https://github.com/nneonneo/fixedint" }, "release_url": "https://pypi.org/project/fixedint/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "simple fixed-width integers", "version": "0.1.4" }, "last_serial": 5168807, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "886be94ff37cdf9481c8babb65ea5793", "sha256": "b6de2c8a454510f53b76f510dbe7e46aadf36b9dfe640c37bcea3271f58c9a1f" }, "downloads": -1, "filename": "fixedint-0.1.0.macosx-10.6-intel.exe", "has_sig": false, "md5_digest": "886be94ff37cdf9481c8babb65ea5793", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 76837, "upload_time": "2014-06-22T02:16:07", "url": "https://files.pythonhosted.org/packages/2c/fa/24681ce6eca356ab45e1aace5ef7197f0c7b2d9816c0493f68ba7b6cac3f/fixedint-0.1.0.macosx-10.6-intel.exe" }, { "comment_text": "", "digests": { "md5": "2b8a5cfd47d1932e42f3a93736dc3241", "sha256": "19faec27a62b1a5f2d8bda84005420f12ac5403ea629eca8e0e815fa742365ab" }, "downloads": -1, "filename": "fixedint-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2b8a5cfd47d1932e42f3a93736dc3241", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11016, "upload_time": "2014-06-22T02:16:05", "url": "https://files.pythonhosted.org/packages/39/54/27d2f90ca05c66d676626d858c76a878bbc546fef36a326b0c02808bc19a/fixedint-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "295b9529640669312ac4c0a563edbd72", "sha256": "4af81494f43e20a888acde6c9a6399479f7bb242a3159ebb77198fd0cf318da4" }, "downloads": -1, "filename": "fixedint-0.1.1.macosx-10.6-intel.exe", "has_sig": false, "md5_digest": "295b9529640669312ac4c0a563edbd72", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 76835, "upload_time": "2014-06-22T02:23:05", "url": "https://files.pythonhosted.org/packages/21/6b/99f14e14d24f39e405b5f4321b61bd46aeef397e841a0b2a422e0732d2f2/fixedint-0.1.1.macosx-10.6-intel.exe" }, { "comment_text": "", "digests": { "md5": "378486f05f4061bdb9c9ffc39f704c83", "sha256": "d34d97e512aaa8dcfaba5e18b17a2f8cf93206400f13f2181a9297307a551568" }, "downloads": -1, "filename": "fixedint-0.1.1.tar.gz", "has_sig": false, "md5_digest": "378486f05f4061bdb9c9ffc39f704c83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11028, "upload_time": "2014-06-22T02:23:02", "url": "https://files.pythonhosted.org/packages/4f/06/ec87df2ce5b941cb184889ef0f336d7168043797b1546d8cf188f5445f06/fixedint-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "797f0f560f224cae26d75fef94ff06af", "sha256": "28cf4e52b8950c59f8fb62e2c5f1315ac9a37120d26a6833a576833d46a76914" }, "downloads": -1, "filename": "fixedint-0.1.2.win-amd64.exe", "has_sig": false, "md5_digest": "797f0f560f224cae26d75fef94ff06af", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 238952, "upload_time": "2014-06-22T02:34:00", "url": "https://files.pythonhosted.org/packages/0d/af/41a4853338e4e7e43ac0c626569ebb2d67d4cef55fe81126bd9f696f0ebd/fixedint-0.1.2.win-amd64.exe" }, { "comment_text": "", "digests": { "md5": "29b97d0e9ac796bc42b0db794c2e953f", "sha256": "dc441b33f6fd64a7d7a5d9298df74e5d0a0bbe31f031c8dfbdffb5e73e8ef08d" }, "downloads": -1, "filename": "fixedint-0.1.2.zip", "has_sig": false, "md5_digest": "29b97d0e9ac796bc42b0db794c2e953f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17357, "upload_time": "2014-06-22T02:33:57", "url": "https://files.pythonhosted.org/packages/c6/3c/e497371a188f5d3f9b753577574d114d24b7652fbc904af472ddfc91d7e9/fixedint-0.1.2.zip" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "f7cb234af7648031538f1a095ae19c5b", "sha256": "5b5114a5e6e4caa800db5632250412a06f2f2e4d4a6756a05439cd70cb0ae21d" }, "downloads": -1, "filename": "fixedint-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f7cb234af7648031538f1a095ae19c5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11105, "upload_time": "2014-06-23T01:40:57", "url": "https://files.pythonhosted.org/packages/b0/38/7375e88f9364eaef63ec525ddf1d2e1b19b85a587208c786a9c998ab90e5/fixedint-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "7729a732734cb7b88fafcc2a8f5c6b2a", "sha256": "1156afdbe2e674de0db576e274d5f27b100b8b9d55bb65621f96d5be9b483f23" }, "downloads": -1, "filename": "fixedint-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "7729a732734cb7b88fafcc2a8f5c6b2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10883, "upload_time": "2019-04-21T00:41:32", "url": "https://files.pythonhosted.org/packages/3e/82/f96c6f0daa16b83368f599b6ac9beb51450a5f49f5e4f38a385a288725c9/fixedint-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "34a5b1042b039d53377a029d73a91bde", "sha256": "04b706d55aaefe43825efdc5b72481113e7040a04e6179277b61f709bba4ab9c" }, "downloads": -1, "filename": "fixedint-0.1.4.tar.gz", "has_sig": false, "md5_digest": "34a5b1042b039d53377a029d73a91bde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12548, "upload_time": "2019-04-21T00:41:34", "url": "https://files.pythonhosted.org/packages/2a/13/ea56391c801424382821178b0da9f93ecd671e478b8d937dfbf2cf48e1d0/fixedint-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7729a732734cb7b88fafcc2a8f5c6b2a", "sha256": "1156afdbe2e674de0db576e274d5f27b100b8b9d55bb65621f96d5be9b483f23" }, "downloads": -1, "filename": "fixedint-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "7729a732734cb7b88fafcc2a8f5c6b2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10883, "upload_time": "2019-04-21T00:41:32", "url": "https://files.pythonhosted.org/packages/3e/82/f96c6f0daa16b83368f599b6ac9beb51450a5f49f5e4f38a385a288725c9/fixedint-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "34a5b1042b039d53377a029d73a91bde", "sha256": "04b706d55aaefe43825efdc5b72481113e7040a04e6179277b61f709bba4ab9c" }, "downloads": -1, "filename": "fixedint-0.1.4.tar.gz", "has_sig": false, "md5_digest": "34a5b1042b039d53377a029d73a91bde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12548, "upload_time": "2019-04-21T00:41:34", "url": "https://files.pythonhosted.org/packages/2a/13/ea56391c801424382821178b0da9f93ecd671e478b8d937dfbf2cf48e1d0/fixedint-0.1.4.tar.gz" } ] }