Naturally, you will be limited by the "native" integer sizes supported on the machine, hence x could be either an 8, 16, 32 or 64-bit integer on most mainstream CPUs.
That said, 11-bit two's complement arithmetic is not that much different, except you will have to sign extend the 11-bit value into the native integer size on the machine. Basically this involves either setting or clearing the remaining upper bits for the native integer, depending on what the MSB is for the 11-bit word. If the MSB is 1, then we fill the remaining upper bits with 1, otherwise we clear them with 0.
Here is an illustrated example of an 11-bit word (7FF) superimposed over 16-bit integer, and its MSB highlighted in red:
xxxxx[color="#ff0000"]111 11111111
If you want to sign extend the two's complement 11-bit integer, the upper xxxxx bits should be either 11111 or 00000, depending on whether the MSB is 1 or 0 respectively. The same rules applies for bigger native integer sizes, except you will need to set or clear more upper bits.
So you homework is:
- Devise a test for the MSB in the 11-bit word;
- Find a method to set upper bits if MSB == true;
- Likewise, clear upper bits if MSB == fasle.