This is possible, but not advised. If you do this, you should cast the int32 to an int256 in order to be explicit.
int32 a = 1;
int256 b = 3;
int256 c = int256(a) + b;
However, using types smaller than 32 bytes may actually be more expensive than using types that are 32 bytes exactly (such as int256, uint256, etc.). The reason for this is that the EVM ...
You are using soliditySha3, which produces a 256-bit (32 bytes) hash, because of that your code works with bytes32.
As you can see in the docs, the output of soliditySha3 is something like the following, with a length of 66, 64 without 0x. Check that one byte corresponds to two chars, so the result is 32 bytes.
var x = web3.utils.soliditySha3('234'); // ...
This is a library for organizing an unordered key set with delete capability.
It is an implementation of the Mapped Structs with Delete-enabled Index technique in the SE page Richard linked to.
The library deals with the keys only. Store structs in a mapping to handle additional fields.
Hope it helps.
Tight packing of storage variables is not unique to structs. From the Solidity documentation on the layout of state variables in storage:
Statically-sized variables (everything except mapping and dynamically-sized array types) are laid out contiguously in storage starting from position 0. Multiple, contiguous items that need less than 32 bytes are packed ...
Your input is not ABI encoded. The correct ABI encoding of those values is as follows:
In ABI ...
You may use fixed point math library such as ABDK Math 64.64. It has method divi that divides one integer by another and returns the result as binary fixed point number with 64 binary digits after dot.