Defining the sample structure

Linus Torvalds torvalds at linux-foundation.org
Wed Apr 23 12:18:12 PDT 2014


On Wed, Apr 23, 2014 at 10:43 AM, Willem Ferguson
<willemferguson at zoology.up.ac.za> wrote:
>
> typedef struct        // new definition; type uint16_t
> {
>     uint16_t seconds;
> } shortduration_t;

Do we care this deeply about memory use? I'd suggest dropping this.

> typedef struct        // type changed to uint16_t
> {
>     uint16_t mkelvin;
> } temperature_t;

No, this is wrong. The temperatures are in milli *kelvin*. 16 bits is
not enough.

And the thing is, we don't want to make this celsius, because we want
zero to mean "no temperature" and 0°C is actually a valid value - even
for water temperatures. Negative celsius temperatures are normal (if
uncommon) for air.

We could make it centi-kelvin instead, which gives us a maximum
temperature of 655.35K, which is certainly fine (382°C, or 719°F ;).

Similarly, I guess we could make depths be in cm rather than mm, and
then 655.35m would certainly be deep enough. I originally went for
"milli" as a proper SI unit, but if we really care about memory use..

That said, do we really care?

                  Linus


More information about the subsurface mailing list