Question

The OSC Specification, version 1.0 specifies the "int32" data type as "32-bit big-endian two's complement integer". This implies that it's signed (otherwise, why would you write "two's complement"...), but it doesn't come right out and say it.

This comes up most clearly in the encoding of blobs: should it be legal to have a blob of length #x90000000 ? This number can be encoded as an unsigned 32-bit integer, but not as a signed 32-bit integer. I grant you, that's an extremely big blob (more than 2 gigabytes).

Was it helpful?

Solution

The specification gives you no more details. I checked the code of the C++ osc implementation I use and it's defined as:

typedef signed long int32;

the blob is defined as:

struct Blob{
    Blob() {}
    explicit Blob( const void* data_, unsigned long size_ )
            : data( data_ ), size( size_ ) {}
    const void* data;
    unsigned long size;
};

So yes, it's signed integer for the "atomic" int32 type.

The blob on the other hand has it's size stored as unsigned long. So probably it can be larger. You may have to try it first, because I have only the implementation of osc pack here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top