Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(U)Int24 Proposed API #25

Open
JustNrik opened this issue Sep 29, 2020 · 7 comments
Open

(U)Int24 Proposed API #25

JustNrik opened this issue Sep 29, 2020 · 7 comments
Labels
contribution Contribution wanted and heavily appreciated help wanted Help wanted up for grabs Up for grabs.

Comments

@JustNrik
Copy link
Owner

JustNrik commented Sep 29, 2020

The implementation of this type should satisfy the followings:

Note: If you help with this issue, please do it on feature-(U)Int24 branch, Thanks.

1. Add these constructors

  • Int24(byte)

  • Int24(sbyte)

  • Int24(short)

  • Int24(ushort)

  • Int24(int)

  • Int24(uint)

  • Int24(long)

  • Int24(ulong)

  • Int24(nint)

  • Int24(nuint)

  • Int24(UInt24)

  • Int24(byte[])

  • Int24(byte[], int)

  • Int24(ReadOnlySpan<byte>)

  • UInt24(byte)

  • UInt24(sbyte)

  • UInt24(short)

  • UInt24(ushort)

  • UInt24(int)

  • UInt24(uint)

  • UInt24(long)

  • UInt24(ulong)

  • UInt24(nint)

  • UInt24(nuint)

  • UInt24(Int24)

  • UInt24(byte[])

  • UInt24(byte[], int)

  • UInt24(ReadOnlySpan<byte>)

2. Properly implement the following interfaces:

Int24

  • IEquatable<Int24>
  • IComparable<Int24>
  • IConvertible
  • IComparable
  • IFormattable

UInt24

  • IEquatable<UInt24>
  • IComparable<UInt24>
  • IConvertible
  • IComparable
  • IFormattable

3. Add the following operators:

Unary Operators

  • Int24 operator +(Int24)
  • Int24 operator -(Int24)
  • UInt24 operator +(UInt24)

Bitwise Complement Operator

  • Int24 operator ~(Int24)
  • UInt24 operator ~(UInt24)

Cast Operators

Int24 -> Signed Number

  • explicit operator sbyte(Int24)
  • explicit operator short(Int24)
  • implicit operator int(Int24)
  • implicit operator long(Int24)

Int24 -> Unsigned Number

  • explicit operator byte(Int24)
  • explicit operator ushort(Int24)
  • explicit operator uint(Int24)
  • explicit operator ulong(Int24)

Signed Number -> Int24

  • explicit operator Int24(int)
  • explicit operator Int24(long)

Unsigned Number -> Int24

  • explicit operator Int24(uint)
  • explicit operator Int24(ulong)

UInt24 -> Int24

  • explicit operator Int24(UInt24)

UInt24 -> Signed Number

  • explicit operator sbyte(UInt24)
  • explicit operator short(UInt24)
  • implicit operator int(UInt24)
  • implicit operator long(UInt24)

UInt24 -> Unsigned Number

  • explicit operator byte(UInt24)
  • explicit operator ushort(UInt24)
  • implicit operator uint(UInt24)
  • implicit operator ulong(UInt24)

Signed Number -> UInt24

  • explicit operator UInt24(int)
  • explicit operator UInt24(long)

Unsigned Number -> UInt24

  • explicit operator UInt24(uint)
  • explicit operator UInt24(ulong)

Int24 -> UInt24

  • explicit operator UInt24(Int24)

Multiplication Operator

  • Int24 operator *(int, Int24)

  • Int24 operator *(Int24, int)

  • Int24 operator *(Int24, Int24)

  • UInt24 operator *(uint, UInt24)

  • UInt24 operator *(UInt24, uint)

  • UInt24 operator *(UInt24, UInt24)

Division Operator

  • Int24 operator /(int, Int24)

  • Int24 operator /(Int24, int)

  • Int24 operator /(Int24, Int24)

  • UInt24 operator /(uint, UInt24)

  • UInt24 operator /(UInt24, uint)

  • UInt24 operator /(UInt24, UInt24)

Remainder Operator

  • Int24 operator %(int, Int24)

  • Int24 operator %(Int24, int)

  • Int24 operator %(Int24, Int24)

  • UInt24 operator %(uint, UInt24)

  • UInt24 operator %(UInt24, uint)

  • UInt24 operator %(UInt24, UInt24)

Addition Operator

  • Int24 operator +(int, Int24)

  • Int24 operator +(Int24, int)

  • Int24 operator +(Int24, Int24)

  • UInt24 operator +(uint, UInt24)

  • UInt24 operator +(UInt24, uint)

  • UInt24 operator +(UInt24, UInt24)

Subtraction Operator

  • Int24 operator -(int, Int24)

  • Int24 operator -(Int24, int)

  • Int24 operator -(Int24, Int24)

  • UInt24 operator -(uint, UInt24)

  • UInt24 operator -(UInt24, uint)

  • UInt24 operator -(UInt24, UInt24)

Shift Operator

  • Int24 operator <<(Int24, int)

  • Int24 operator >>(Int24, int)

  • UInt24 operator <<(UInt24, uint)

  • UInt24 operator >>(UInt24, uint)

Integer Comparison Operators

  • bool operator ==(int, Int24)

  • bool operator ==(Int24, int)

  • bool operator ==(Int24, Int24)

  • bool operator !=(int, Int24)

  • bool operator !=(Int24, int)

  • bool operator !=(Int24, Int24)

  • bool operator <(int, Int24)

  • bool operator <(Int24, int)

  • bool operator <(Int24, Int24)

  • bool operator >(int, Int24)

  • bool operator >(Int24, int)

  • bool operator >(Int24, Int24)

  • bool operator <=(int, Int24)

  • bool operator <=(Int24, int)

  • bool operator <=(Int24, Int24)

  • bool operator >=(int, Int24)

  • bool operator >=(Int24, int)

  • bool operator >=(Int24, Int24)

  • bool operator ==(uint, UInt24)

  • bool operator ==(UInt24, uint)

  • bool operator ==(UInt24, UInt24)

  • bool operator !=(uint, UInt24)

  • bool operator !=(UInt24, uint)

  • bool operator !=(UInt24, UInt24)

  • bool operator <(uint, UInt24)

  • bool operator <(UInt24, uint)

  • bool operator <(UInt24, UInt24)

  • bool operator >(uint, UInt24)

  • bool operator >(UInt24, uint)

  • bool operator >(UInt24, UInt24)

  • bool operator <=(uint, UInt24)

  • bool operator <=(UInt24, uint)

  • bool operator <=(UInt24, UInt24)

  • bool operator >=(uint, UInt24)

  • bool operator >=(UInt24, uint)

  • bool operator >=(UInt24, UInt24)

Integer Logical Operators

  • Int24 operator &(int, Int24)

  • Int24 operator &(Int24, int)

  • Int24 operator &(Int24, Int24)

  • Int24 operator |(int, Int24)

  • Int24 operator |(Int24, int)

  • Int24 operator |(Int24, Int24)

  • Int24 operator ^(int, Int24)

  • Int24 operator ^(Int24, int)

  • Int24 operator ^(Int24, Int24)

  • UInt24 operator &(uint, UInt24)

  • UInt24 operator &(UInt24, uint)

  • UInt24 operator &(UInt24, UInt24)

  • UInt24 operator |(uint, UInt24)

  • UInt24 operator |(UInt24, uint)

  • UInt24 operator |(UInt24, UInt24)

  • UInt24 operator ^(uint, UInt24)

  • UInt24 operator ^(UInt24, uint)

  • UInt24 operator ^(UInt24, UInt24)

4. Add Parse and TryParse static methods and Min/Max Value constants

  • Int24 MaxValue

  • Int24 MinValue

  • Int24 Parse(string)

  • Int24 Parse(string, NumberStyles)

  • Int24 Parse(string, NumberStyles, IFormatProvider?)

  • bool TryParse(string, out Int24)

  • bool TryParse(string, NumberStyles, out Int24)

  • bool TryParse(string, NumberStyles, IFormatProvider?, out Int24)

  • UInt24 MaxValue

  • UInt24 MinValue

  • UInt24 Parse(string)

  • UInt24 Parse(string, NumberStyles)

  • UInt24 Parse(string, NumberStyles, IFormatProvider?)

  • bool TryParse(string, out UInt24)

  • bool TryParse(string, NumberStyles, out UInt24)

  • bool TryParse(string, NumberStyles, IFormatProvider?, out UInt24)

5. Add documentation to all public members (except operators)

  • Int24 Constructors

  • UInt24 Constructors

  • Int24 MaxValue

  • Int24 MinValue

  • Int24 Parse(string)

  • Int24 Parse(string, NumberStyles)

  • Int24 Parse(string, NumberStyles, IFormatProvider?)

  • bool TryParse(string, out Int24)

  • bool TryParse(string, NumberStyles, out Int24)

  • bool TryParse(string, NumberStyles, IFormatProvider?, out Int24)

  • UInt24 MaxValue

  • UInt24 MinValue

  • UInt24 Parse(string)

  • UInt24 Parse(string, NumberStyles)

  • UInt24 Parse(string, NumberStyles, IFormatProvider?)

  • bool TryParse(string, out UInt24)

  • bool TryParse(string, NumberStyles, out UInt24)

  • bool TryParse(string, NumberStyles, IFormatProvider?, out UInt24)

6. Add tests to ensure all the implementation is correct.

Int24

  • Add tests for Constructors
  • Add tests for Interfaces
  • Add tests for Unary Operators
  • Add tests for Bitwise Complement Operators
  • Add tests for Cast Operators
  • Add tests for Multiplication Operators
  • Add tests for Division Operators
  • Add tests for Remainder Operators
  • Add tests for Addition Operators
  • Add tests for Subtraction Operators
  • Add tests for Shift Operators
  • Add tests for Integer Comparison Operators
  • Add tests for Integer Logical Operators
  • Add tests for Parse
  • Add tests for TryParse

UInt24

  • Add tests for Constructors
  • Add tests for Interfaces
  • Add tests for Unary Operators
  • Add tests for Bitwise Complement Operators
  • Add tests for Cast Operators
  • Add tests for Multiplication Operators
  • Add tests for Division Operators
  • Add tests for Remainder Operators
  • Add tests for Addition Operators
  • Add tests for Subtraction Operators
  • Add tests for Shift Operators
  • Add tests for Integer Comparison Operators
  • Add tests for Integer Logical Operators
  • Add tests for Parse
  • Add tests for TryParse
@JustNrik JustNrik added help wanted Help wanted contribution Contribution wanted and heavily appreciated up for grabs Up for grabs. labels Sep 29, 2020
@Emzi0767
Copy link
Contributor

Dibs.

@AraHaan
Copy link
Contributor

AraHaan commented Mar 13, 2021

Is it possible to implement an (U)Int128, (U)Int256, and a (U)Int512 for cryptographic reasons?

@JustNrik
Copy link
Owner Author

Is it possible to implement an (U)Int128, (U)Int256, and a (U)Int512 for cryptographic reasons?

Feel free to provide your implementation, I have no idea how to implement those lol. (U)Int128 is already going to be a thing in .NET 6 or 7 iirc.

@AraHaan
Copy link
Contributor

AraHaan commented Mar 14, 2021

I mean I do not think they can add them in .NET 6 or 7 yet because there lacks a language change to add an (U)Int128 keyword first.

So ye they need to add keywords for them to a language version first before finalizing it in to the runtime / framework code in order to be able to use them.

@Erik-Bard
Copy link
Contributor

@AraHaan Hello I want to push my Test Code that ive created but I dont have access. Please allow me to push my branch for reviewment and maybe pull request :)

Dont know where to @ you otherwise :)

@zackJKnight
Copy link

@AraHaan Hello I want to push my Test Code that ive created but I dont have access. Please allow me to push my branch for reviewment and maybe pull request :)

Dont know where to @ you otherwise :)

One way to do this without permission is to Fork the repo. This makes a copy of the repo under your GitHub account. Then you make a branch and push it to your fork. Then open a pull request with the target branch as Main or develop of the original repo.

@AraHaan
Copy link
Contributor

AraHaan commented Nov 7, 2021

That is how I do it as well because there are security reasons for doing it where everyone must use a fork to PR changes in.

Mainly because users with direct write access can commit anything to the main branch without reviews so then we would not know if someone could have added some trojan source into it until a tool (or github) tells us about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Contribution wanted and heavily appreciated help wanted Help wanted up for grabs Up for grabs.
Projects
None yet
Development

No branches or pull requests

5 participants