Both your questions can be answered by reading RFC 791 on the Internet Protocol.
First of all, where did you get that Options field size? An IPv4 header can contain up to 40 bytes (320 bits) of options.
The length of the IP header is indicated in the Internet Header Length (IHL) field. It uses 32 bit words as the unit of length, so the total size of the header is the value of IHL times 32 bits.
Since the IHL is a 4 bit field, the maximum value is 15. This results in a maximum header size of 15 x 32, or 480 bits.
A minimal IP header without options is 160 bits (IHL = 5). This leaves 480-160, or 320 bits for options.
As for your second question, the structure of the option field is not free, it should contain an option list as defined on RFC 791, page 15. If options are present, you should add yours behind them, at the end of the list.
Doing NAT from IPv6 to IPv4 is possible because you can embed the IPv4 address inside the IPv6 address. This is usually done with DNS64.
Doing NAT from IPv4 to IPv6 is much harder because you can't embed an IPv6 address inside an IPv4 address. That doesn't fit. Matt is still possible, but you'd have to statically configure mappings between IPv4 and IPv6 address.
I don't know if the Linux kernel can do that, but it's a bad idea anyway. Because of the different header lengths you'll run into issues with fragmentation and MTU sizes. Using a proxy would be a much better idea.
Best Answer
If you are using python you can do it simply with the IPAddress object from the netaddr library.
To get an integer value of an IPAddress object you can do the following
So you could do something like this
Edit: If you just have pen and paper, here is how you do it.
You'll have to convert both to decimal form, add the two and convert from decimal to binary. When you convert 122.13.17.34 to binary break each octet out and convert that to binary, which will give you 01111010.00001101.00010001.00100010 then remove the dots can you get 01111010000011010001000100100010. Now convert that to a decimal number and you'll get 2047676706. Now 2047676706 + 1023 = 2047677729. Convert that back to binary and you'll get 01111010000011010001010100100001. Now breaking that up into octets and just convert those octets back to decimal and you'll get 122.13.21.33