Values get truncated during this conversion in such a way that the less significant bits are preserved, but the higher bits are lost. This is consistent whether you use a big or little endian machine.
In your specific example, 123456 is written as 11110001001000000 in binary.
Keep in mind that ints use 4 bytes, so there are a bunch of leading zeros that I omitted from that number. Shorts are limited to 2 bytes, immediately truncating the number to 1110001001000000 strictly. Notice that there is a 1 in front, which in 2's complement would immediately indicate a negative number.
Going through the 2's complement process shows how you would get the result you did.
In C, when you convert an int to a short, you are already asking for trouble. In cases like when working with .wav files, you typically use int datatypes for manipulation of attributes before using a series of if statements to control truncation.
//you will need to #include <limits.h>
int i = 123456;
short s;
if(i > SHRT_MIN && i < SHRT_MAX) //if your int is within the range of shorts
{
s = i;
}
//if your int is too large or too negative, you can control the truncation
if(i < SHRT_MIN) //if int is too negative
{
i=SHRT_MIN;
}
else //if int is too positive
{
i=SHRT_MAX;
}