public static function sLongToBytes($value, $endian)
    {
        /*
         * We can convert the number into bytes in the normal way using
         * shifts and modulo calculations here (in contrast with
         * longToBytes) because PHP automatically handles 32 bit signed
         * integers for us.
         */
        if ($endian == self::LITTLE_ENDIAN) {
            return (chr($value) . chr($value >> 8) . chr($value >> 16) . chr($value >> 24));
        } else {
            return (chr($value >> 24) . chr($value >> 16) . chr($value >> 8) . chr($value));
        }
    }