Skip to content

Commit

Permalink
Renamed structs to a PascalCase name
Browse files Browse the repository at this point in the history
  • Loading branch information
jozzzzep committed Nov 5, 2020
1 parent 6d03eff commit b447d41
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 48 deletions.
48 changes: 24 additions & 24 deletions Files/eint.cs → Files/EncInt.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

public struct eint
public struct EncInt
{
/// A struct for storing a 32-bit integer while efficiently keeping it encrypted in the memory.
/// In the memory it is saved as a floating-point number that is affected by random values. { encryptionKey1 & encryptionKey2 }
Expand Down Expand Up @@ -37,7 +37,7 @@ private double Value

#region Constructors

private eint(int value)
private EncInt(int value)
{
// set default values
encryptionKey1 = 0;
Expand Down Expand Up @@ -87,7 +87,7 @@ public override string ToString()
// Not recommended to use
public override bool Equals(object obj)
{
return obj is eint eint &&
return obj is EncInt eint &&
(int)Value == (int)eint.Value;
}
public override int GetHashCode()
Expand All @@ -100,32 +100,32 @@ public override int GetHashCode()
#region Operators Overloading

/// + - * / %
public static eint operator +(eint eint1, eint eint2) => new eint((int)(eint1.Value + eint2.Value));
public static eint operator -(eint eint1, eint eint2) => new eint((int)(eint1.Value - eint2.Value));
public static eint operator *(eint eint1, eint eint2) => new eint((int)(eint1.Value * eint2.Value));
public static eint operator /(eint eint1, eint eint2) => new eint((int)(eint1.Value / eint2.Value));
public static eint operator %(eint eint1, eint eint2) => new eint((int)(eint1.Value % eint2.Value));

public static int operator +(eint eint1, int eint2) => (int)eint1.Value + eint2;
public static int operator -(eint eint1, int eint2) => (int)eint1.Value - eint2;
public static int operator *(eint eint1, int eint2) => (int)eint1.Value * eint2;
public static int operator /(eint eint1, int eint2) => (int)eint1.Value / eint2;
public static int operator %(eint eint1, int eint2) => (int)eint1.Value % eint2;
public static EncInt operator +(EncInt eint1, EncInt eint2) => new EncInt((int)(eint1.Value + eint2.Value));
public static EncInt operator -(EncInt eint1, EncInt eint2) => new EncInt((int)(eint1.Value - eint2.Value));
public static EncInt operator *(EncInt eint1, EncInt eint2) => new EncInt((int)(eint1.Value * eint2.Value));
public static EncInt operator /(EncInt eint1, EncInt eint2) => new EncInt((int)(eint1.Value / eint2.Value));
public static EncInt operator %(EncInt eint1, EncInt eint2) => new EncInt((int)(eint1.Value % eint2.Value));

public static int operator +(EncInt eint1, int eint2) => (int)eint1.Value + eint2;
public static int operator -(EncInt eint1, int eint2) => (int)eint1.Value - eint2;
public static int operator *(EncInt eint1, int eint2) => (int)eint1.Value * eint2;
public static int operator /(EncInt eint1, int eint2) => (int)eint1.Value / eint2;
public static int operator %(EncInt eint1, int eint2) => (int)eint1.Value % eint2;

/// == != < >
public static bool operator ==(eint eint1, int eint2) => (int)eint1.Value == eint2;
public static bool operator !=(eint eint1, int eint2) => (int)eint1.Value != eint2;
public static bool operator >(eint eint1, int eint2) => (int)eint1.Value > eint2;
public static bool operator <(eint eint1, int eint2) => (int)eint1.Value < eint2;
public static bool operator ==(EncInt eint1, int eint2) => (int)eint1.Value == eint2;
public static bool operator !=(EncInt eint1, int eint2) => (int)eint1.Value != eint2;
public static bool operator >(EncInt eint1, int eint2) => (int)eint1.Value > eint2;
public static bool operator <(EncInt eint1, int eint2) => (int)eint1.Value < eint2;

public static bool operator ==(eint eint1, eint eint2) => (int)eint1.Value == (int)eint2.Value;
public static bool operator !=(eint eint1, eint eint2) => (int)eint1.Value != (int)eint2.Value;
public static bool operator <(eint eint1, eint eint2) => (int)eint1.Value < (int)eint2.Value;
public static bool operator >(eint eint1, eint eint2) => (int)eint1.Value > (int)eint2.Value;
public static bool operator ==(EncInt eint1, EncInt eint2) => (int)eint1.Value == (int)eint2.Value;
public static bool operator !=(EncInt eint1, EncInt eint2) => (int)eint1.Value != (int)eint2.Value;
public static bool operator <(EncInt eint1, EncInt eint2) => (int)eint1.Value < (int)eint2.Value;
public static bool operator >(EncInt eint1, EncInt eint2) => (int)eint1.Value > (int)eint2.Value;

/// assign
public static implicit operator eint(int value) => new eint(value);
public static implicit operator int(eint eint1) => (int)eint1.Value;
public static implicit operator EncInt(int value) => new EncInt(value);
public static implicit operator int(EncInt eint1) => (int)eint1.Value;

#endregion

Expand Down
48 changes: 24 additions & 24 deletions Files/elong.cs → Files/EncLong.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

public struct elong
public struct EncLong
{
/// A struct for storing a 64-bit integer while efficiently keeping it encrypted in the memory.
/// In the memory it is saved as a floating-point number that is affected by random values. { encryptionKey1 & encryptionKey2 }
Expand Down Expand Up @@ -37,7 +37,7 @@ private decimal Value

#region Constructors

private elong(long value)
private EncLong(long value)
{
// set default values
encryptionKey1 = 0;
Expand Down Expand Up @@ -87,7 +87,7 @@ public override string ToString()
// Not recommended to use
public override bool Equals(object obj)
{
return obj is elong eint &&
return obj is EncLong eint &&
(long)Value == (long)eint.Value;
}
public override int GetHashCode()
Expand All @@ -100,32 +100,32 @@ public override int GetHashCode()
#region Operators Overloading

/// + - * / %
public static elong operator +(elong eint1, elong eint2) => new elong((long)(eint1.Value + eint2.Value));
public static elong operator -(elong eint1, elong eint2) => new elong((long)(eint1.Value - eint2.Value));
public static elong operator *(elong eint1, elong eint2) => new elong((long)(eint1.Value * eint2.Value));
public static elong operator /(elong eint1, elong eint2) => new elong((long)(eint1.Value / eint2.Value));
public static elong operator %(elong eint1, elong eint2) => new elong((long)(eint1.Value % eint2.Value));

public static long operator +(elong eint1, long eint2) => (long)eint1.Value + eint2;
public static long operator -(elong eint1, long eint2) => (long)eint1.Value - eint2;
public static long operator *(elong eint1, long eint2) => (long)eint1.Value * eint2;
public static long operator /(elong eint1, long eint2) => (long)eint1.Value / eint2;
public static long operator %(elong eint1, long eint2) => (long)eint1.Value % eint2;
public static EncLong operator +(EncLong eint1, EncLong eint2) => new EncLong((long)(eint1.Value + eint2.Value));
public static EncLong operator -(EncLong eint1, EncLong eint2) => new EncLong((long)(eint1.Value - eint2.Value));
public static EncLong operator *(EncLong eint1, EncLong eint2) => new EncLong((long)(eint1.Value * eint2.Value));
public static EncLong operator /(EncLong eint1, EncLong eint2) => new EncLong((long)(eint1.Value / eint2.Value));
public static EncLong operator %(EncLong eint1, EncLong eint2) => new EncLong((long)(eint1.Value % eint2.Value));

public static long operator +(EncLong eint1, long eint2) => (long)eint1.Value + eint2;
public static long operator -(EncLong eint1, long eint2) => (long)eint1.Value - eint2;
public static long operator *(EncLong eint1, long eint2) => (long)eint1.Value * eint2;
public static long operator /(EncLong eint1, long eint2) => (long)eint1.Value / eint2;
public static long operator %(EncLong eint1, long eint2) => (long)eint1.Value % eint2;

/// == != < >
public static bool operator ==(elong eint1, long eint2) => (long)eint1.Value == eint2;
public static bool operator !=(elong eint1, long eint2) => (long)eint1.Value != eint2;
public static bool operator >(elong eint1, long eint2) => (long)eint1.Value > eint2;
public static bool operator <(elong eint1, long eint2) => (long)eint1.Value < eint2;
public static bool operator ==(EncLong eint1, long eint2) => (long)eint1.Value == eint2;
public static bool operator !=(EncLong eint1, long eint2) => (long)eint1.Value != eint2;
public static bool operator >(EncLong eint1, long eint2) => (long)eint1.Value > eint2;
public static bool operator <(EncLong eint1, long eint2) => (long)eint1.Value < eint2;

public static bool operator ==(elong eint1, elong eint2) => (long)eint1.Value == (long)eint2.Value;
public static bool operator !=(elong eint1, elong eint2) => (long)eint1.Value != (long)eint2.Value;
public static bool operator <(elong eint1, elong eint2) => (long)eint1.Value < (long)eint2.Value;
public static bool operator >(elong eint1, elong eint2) => (long)eint1.Value > (long)eint2.Value;
public static bool operator ==(EncLong eint1, EncLong eint2) => (long)eint1.Value == (long)eint2.Value;
public static bool operator !=(EncLong eint1, EncLong eint2) => (long)eint1.Value != (long)eint2.Value;
public static bool operator <(EncLong eint1, EncLong eint2) => (long)eint1.Value < (long)eint2.Value;
public static bool operator >(EncLong eint1, EncLong eint2) => (long)eint1.Value > (long)eint2.Value;

/// assign
public static implicit operator elong(long value) => new elong(value);
public static implicit operator long(elong eint1) => (long)eint1.Value;
public static implicit operator EncLong(long value) => new EncLong(value);
public static implicit operator long(EncLong eint1) => (long)eint1.Value;

#endregion

Expand Down

0 comments on commit b447d41

Please sign in to comment.