mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Removed double subtraction of float size from 'bits_remaining' for floating point reads
This commit is contained in:
parent
4bcd734dad
commit
536fd412a3
@ -314,8 +314,6 @@ namespace etl
|
||||
|
||||
from_bytes(data, value);
|
||||
|
||||
bits_remaining -= width;
|
||||
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1041,5 +1041,31 @@ namespace
|
||||
CHECK_EQUAL(object1, object1a);
|
||||
CHECK_EQUAL(object2, object2a);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(put_get_multiple_float)
|
||||
{
|
||||
|
||||
float f = 3.1415927f;
|
||||
double d = 3.1415927;
|
||||
|
||||
std::array<unsigned char, 12> storage;
|
||||
|
||||
etl::bit_stream bit_stream(storage.data(), storage.size());
|
||||
|
||||
bit_stream.put(f);
|
||||
bit_stream.put(d);
|
||||
|
||||
bit_stream.restart();
|
||||
|
||||
float rf;
|
||||
double rd;
|
||||
|
||||
CHECK(bit_stream.get(rf));
|
||||
CHECK_CLOSE(f, rf, 0.1f);
|
||||
|
||||
CHECK(bit_stream.get(rd));
|
||||
CHECK_CLOSE(f, rd, 0.1f);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user