src/audio/SDL_audiotypecvt.c
changeset 11995 b34d86386ee1
parent 11993 fdf104726ced
child 12056 523e803a0192
equal deleted inserted replaced
11994:8e094f91ddab 11995:b34d86386ee1
   807     for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
   807     for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) {
   808         const float sample = *src;
   808         const float sample = *src;
   809         if (sample >= 1.0f) {
   809         if (sample >= 1.0f) {
   810             *dst = 2147483647;
   810             *dst = 2147483647;
   811         } else if (sample <= -1.0f) {
   811         } else if (sample <= -1.0f) {
   812             *dst = -2147483648;
   812             *dst = (Sint32) -2147483648LL;
   813         } else {
   813         } else {
   814             *dst = ((Sint32)(sample * 8388607.0f)) << 8;
   814             *dst = ((Sint32)(sample * 8388607.0f)) << 8;
   815         }
   815         }
   816     }
   816     }
   817 
   817 
   835     while (i) {
   835     while (i) {
   836         const float sample = *src;
   836         const float sample = *src;
   837         if (sample >= 1.0f) {
   837         if (sample >= 1.0f) {
   838             *dst = 2147483647;
   838             *dst = 2147483647;
   839         } else if (sample <= -1.0f) {
   839         } else if (sample <= -1.0f) {
   840             *dst = -2147483648;
   840             *dst = (Sint32) -2147483648LL;
   841         } else {
   841         } else {
   842             *dst = ((Sint32)(sample * 8388607.0f)) << 8;
   842             *dst = ((Sint32)(sample * 8388607.0f)) << 8;
   843         }
   843         }
   844         i--; src++; dst++;
   844         i--; src++; dst++;
   845     }
   845     }