Because the BYOND release is still in beta I haven't updated the hub version, so users will have to manually download the update rather than being prompted to. Once the version is no longer in beta, I'll go ahead and push the new version to everyone.
Thanks to operator overloading, it's a little bit easier to use the library. Most method calls are no longer needed (there are a few exceptions), and now you can largely use pif_LongInt objects like BYOND's built-in numbers. For example, the Choose() method I've repeatedly used as an example now looks like this:
proc/Choose(n, k, type = /pif_LongInt/Unsigned32)
* This method was found at:
var/pif_LongInt/Int = new type(1)
if(k > (n-k))
// Choose(n, k) = Choose(n, n-k) so by doing this we reduce the
// number of steps needed.
k = n-k
for(var/i = 0, i <= k-1, i ++)
Int *= n-i
Int /= i+1
The library now fully supports the PIF_NOPREFIX_GENERAL, PIF_NOPREFIX_ARITHMETIC, and PIF_NOPREFIX_LONGINT preprocessor directives, which are present in all my other libraries. The short of it is that if you don't like writing pif_ in pif_LongInt all the time, you can throw the line #define PIF_NOPREFIX_LONGINT into your code somewhere and you'll only need to write LongInt instead.
I have added a ToFloat() method to both the Unsigned32 and Signed32 classes, that will output the nearest floating point integer to the integer stored in the integer object.
The last update was an inclusion of an "Introduction & Overview" section in the documentation. This isn't a full documentation of the library—which will be longer and take a lot more time, and I'm lazy so I don't feel like doing it right now—but it does give a quick summary of the important details. That should make it a little easier for newbies to understand how to use it.
As with the last update, if you're using the library I'd love to hear about it! It's nice to know that someone is using the library. Likewise, if you find a bug, post a bug report so I can get it fixed.
- The library now supports the newly-implemented overloaded operators feature. This means that the integer classes can be used much more like BYOND's built in numeric types, without having to make explicit method calls. This change requires at least BYOND v512 to work.
- Made the library compliant with the PIF_NOPREFIX_GENERAL preprocessor flag that's universal in my libraries, and added a specific PIF_NOPREFIX_LONGINT flag.
- Added the ToFloat() method, which allows one to convert from a pif_LongInt object to BYOND's floating point number representation.
- Added an "Introduction & Overview" section, which gives a brief description of how to use this library.
The MIT License
Copyright (c) 2016-2017 Timothy "popisfizzy" Reilly Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.