paulftw / hiberlite

C++ ORM for SQLite
BSD 3-Clause "New" or "Revised" License
714 stars 118 forks source link

Add support for unsigned long long #19

Closed paulftw closed 8 years ago

paulftw commented 8 years ago

This should fix #16

paulftw commented 8 years ago

@d-led could you please take a look if this change makes sense? I'm not sure about the unsigned/signed conversion

d-led commented 8 years ago

unsigned long long is at least 64bit, but a quick search doesn't yield a platform, where this could be bigger, thus I'd say 64bit is ok. As for signedness, let's write a test. (can't do at the moment, will think about one in the evening)

d-led commented 8 years ago

first approach check if ULLONG_MAX survives:

ull_t max = { ULLONG_MAX };
// struct to avoid compiler warning C4307
REQUIRE((max.v + 1) == 0);
bean_ptr<ull_t> id = db.copyBean(max);
bean_ptr<ull_t> max_new = db.loadBean<ull_t>(id.get_id());
CHECK(max_new->v == max.v);

didn't have time to make a runnable test yet

d-led commented 8 years ago

looks ok for me, since storing and retrieving the maximum value of unsigned long long works. If a platform that has a bigger ull comes around, it'll need a breaking change, but it's probably unlikely