how do I use a 40 bit unsigned integer?

I want to use a variable of type uint40_t in my program. What do I need to do to make this work?

currently, i have the following code fragments..

uint40_t testLongNumber;

void setup()
{
    testLongNumber=9876543210;

}

The compiler returns the error

error: 'uint40_t' does not name a type In function 'void setup()':

I think i need to #define what a uint40_t is, but not sure how I do it. Anyone know how?

Thanks

I think i need to #define what a uint40_t is, but not sure how I do it

You will only be scratching the surface. The Atmel processors used for the Arduino are 8 bit processors. Integers larger than 8 bits require multiple machine instructions (support from the compiler) or library functions (support from the run-time library) or both. uint40_t is not defined in the Arduino environment so you will have to provide the code to store, print, and manipulate them.

uint64_t is defined. If you're willing to sacrafice storage, that may work instead of uint40_t.

interesting - changing the variable type to uint64_t resulted in the compiler error:

error: integer constant is too large for 'long' type In function 'void setup()':

i thought unit64_t was longlong?

Here is some code that compiles. Notice the LL at the end of the constant value.

uint64_t testLongNumber, a, b;

void setup()
{
  testLongNumber=9876543210LL;
  a = testLongNumber+testLongNumber;
  b = testLongNumber*testLongNumber;
}

However there are several issues to resolve. - Serial.print does not seem to support printing out uint64_t types. This could be fixed. - By all reports the arithmetic operations on unsigned long long int values are not tuned by the compiler. After all this is a 8-bit processor and 99.99% people do not need 64-bit integers.