Are you doing this on an Arduino, or a ChipKit, since you cross-posted to the ChipKit site.
If it's on a ChipKit, then read my answer on the ChipKit site about 32-bit integers and sign extend.
Are you doing this on an Arduino, or a ChipKit, since you cross-posted to the ChipKit site.
If it's on a ChipKit, then read my answer on the ChipKit site about 32-bit integers and sign extend.