/* { "description" : "An object to represent and manipulate signed host-size integers (Dana primitive integers are all unsigned). These values are internally stored using two's complement. In general, Dana programs will use only int and dec types for their internal logic and will avoid the use of signed integers; this API is primarily intended to support the import and export of signed integers to external systems or data formats." } */
interface SignedInt {
/* { "@description" : "Creates a new signed integer instance, initialised either from an absolute value (val) or from a positive value which should be made negative (neg). An absolute value is assumed not to need any treatment and is set directly as the internal value of the signed integer (via new SignedInt(n)). This value may either be intended as a positive integer, or a value from the getValue() function of another signed integer instance. A negative value (e.g. using new SignedInt(neg = n)) is assumed to be a positive unsigned integer at the point of input, such as the value 4, which is converted to a negative value in the SignedInt instance, such as -4." } */
SignedInt(opt int val, opt int neg)
/* { "@description" : "Subtract a given signed integer value from this instance's current value. The instance's current value is modified to equal the result, which is also returned." } */
int subtract(int val)
/* { "@description" : "Add a given signed integer value to this instance's current value. The instance's current value is modified to equal the result, which is also returned." } */
int add(int val)
/* { "@description" : "Multiply this instance's current value by a given signed integer value. The instance's current value is modified to equal the result, which is also returned." } */
int multiply(int val)
/* { "@description" : "Divide this instance's current value by a given signed integer value. The instance's current value is modified to equal the result, which is also returned." } */
int divide(int val)
/* { "@description" : "Get the value of this signed integer, as an int, suitable for use as a parameter to other SignedInt instances." } */
int getValue()
/* { "@description" : "Set the value of this signed integer." } */
void setValue(int v)
/* { "@description" : "Test is this signed integer instance currently holds a negative value." } */
bool isNegative()
/* { "@description" : "Invert the sign of this signed integer instance, changing it from positive to negative, or vice-versa." } */
void invert()
/* { "@description" : "Get the raw bytes of this signed integer instance." } */
byte[] getBytes()
}
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n data.SignedInt -m "reason for update" -u yourUsername
Version 3 (this version) by barry
Notes for this version: Updates docstrings to clarify various details