in hessian2/basic_codec/number_codec.cc [289:317]
bool Encoder::encode(const int64_t &data) {
if (data >= -0x08 && data <= 0x0f) {
writer_->writeByte(data + 0xe0);
return true;
}
if (data >= -0x800 && data <= 0x7ff) {
writer_->writeByte(0xf8 + (data >> 8));
writer_->writeByte(data);
return true;
}
if (data >= -0x40000 && data <= 0x3ffff) {
writer_->writeByte(0x3c + (data >> 16));
writer_->writeByte(data >> 8);
writer_->writeByte(data);
return true;
}
if (data >= -0x80000000L && data <= 0x7fffffffL) {
writer_->writeByte(0x59);
writer_->writeBE<int32_t>(data);
return true;
}
writer_->writeByte(0x4c);
writer_->writeBE<int64_t>(data);
return true;
}