Changeset b5c2d452c919c7ae398969e5a8875858b35f2fa3
- Timestamp:
- 06/08/04 19:28:36
(4 years ago)
- Author:
- Sam Hocevar <sam@videolan.org>
- git-committer:
- Sam Hocevar <sam@videolan.org> 1091813316 +0000
- git-parent:
[7e6650a16c7cc9ddbca73d9f0338a2fa21fc4182]
- git-author:
- Sam Hocevar <sam@videolan.org> 1091813316 +0000
- Message:
- Really fixed strict aliasing breakage here and there.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rd1c0b83 |
rb5c2d45 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: float32tos16.c,v 1.14 2003/12/04 16:02:54 sam Exp $ |
|---|
| | 5 | * $Id$ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Christophe Massiot <massiot@via.ecp.fr> |
|---|
| … | … | |
| 93 | 93 | #else |
|---|
| 94 | 94 | /* This is walken's trick based on IEEE float format. */ |
|---|
| 95 | | float f_in = *p_in + 384.0; |
|---|
| 96 | | int32_t i_in; |
|---|
| 97 | | i_in = *(int32_t *)(intptr_t)&f_in; |
|---|
| 98 | | if ( i_in > 0x43c07fff ) *p_out = 32767; |
|---|
| 99 | | else if ( i_in < 0x43bf8000 ) *p_out = -32768; |
|---|
| 100 | | else *p_out = i_in - 0x43c00000; |
|---|
| | 95 | union { float f; int32_t i; } u; |
|---|
| | 96 | u.f = *p_in + 384.0; |
|---|
| | 97 | if ( u.i > 0x43c07fff ) *p_out = 32767; |
|---|
| | 98 | else if ( u.i < 0x43bf8000 ) *p_out = -32768; |
|---|
| | 99 | else *p_out = u.i - 0x43c00000; |
|---|
| 101 | 100 | #endif |
|---|
| 102 | 101 | p_in++; p_out++; |
|---|
| rd1c0b83 |
rb5c2d45 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: s16tofloat32.c,v 1.7 2003/12/04 16:02:54 sam Exp $ |
|---|
| | 5 | * $Id$ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 96 | 96 | * this takes 16 seconds to perform one billion conversions, instead |
|---|
| 97 | 97 | * of 19 seconds for the above division. */ |
|---|
| 98 | | int32_t i_out = *p_in + 0x43c00000; |
|---|
| 99 | | float f_out = *(float *)(intptr_t)&i_out; |
|---|
| 100 | | *p_out = f_out - 384.0; |
|---|
| | 98 | union { float f; int32_t i; } u; |
|---|
| | 99 | u.i = *p_in + 0x43c00000; |
|---|
| | 100 | *p_out = u.f - 384.0; |
|---|
| 101 | 101 | #endif |
|---|
| 102 | 102 | |
|---|
| r394b2dc |
rb5c2d45 |
|
| 177 | 177 | int i_ret, i_format; |
|---|
| 178 | 178 | unsigned long i, i_items, i_bytesafter; |
|---|
| 179 | | Atom net_wm_supported, net_wm_state, net_wm_state_on_top, *p_args = NULL; |
|---|
| | 179 | Atom net_wm_supported, net_wm_state, net_wm_state_on_top; |
|---|
| | 180 | union { Atom *p_atom; unsigned char *p_char; } p_args; |
|---|
| | 181 | |
|---|
| | 182 | p_args.p_atom = NULL; |
|---|
| 180 | 183 | |
|---|
| 181 | 184 | net_wm_supported = XInternAtom( XDISPLAY, "_NET_SUPPORTED", False ); |
|---|
| … | … | |
| 186 | 189 | &net_wm_supported, |
|---|
| 187 | 190 | &i_format, &i_items, &i_bytesafter, |
|---|
| 188 | | (unsigned char **)(intptr_t)&p_args ); |
|---|
| | 191 | (unsigned char **)&p_args ); |
|---|
| 189 | 192 | |
|---|
| 190 | 193 | if( i_ret != Success || i_items == 0 ) return; /* Not supported */ |
|---|
| … | … | |
| 196 | 199 | for( i = 0; i < i_items; i++ ) |
|---|
| 197 | 200 | { |
|---|
| 198 | | if( p_args[i] == net_wm_state_on_top ) break; |
|---|
| 199 | | } |
|---|
| 200 | | |
|---|
| 201 | | XFree( p_args ); |
|---|
| | 201 | if( p_args.p_atom[i] == net_wm_state_on_top ) break; |
|---|
| | 202 | } |
|---|
| | 203 | |
|---|
| | 204 | XFree( p_args.p_atom ); |
|---|
| 202 | 205 | if( i == i_items ) return; /* Not supported */ |
|---|
| 203 | 206 | |
|---|
| r5833047 |
rb5c2d45 |
|
| 2188 | 2188 | int i_ret, i_format; |
|---|
| 2189 | 2189 | unsigned long i, i_items, i_bytesafter; |
|---|
| 2190 | | Atom net_wm_supported, *p_args = NULL; |
|---|
| | 2190 | Atom net_wm_supported; |
|---|
| | 2191 | union { Atom *p_atom; unsigned char *p_char; } p_args; |
|---|
| | 2192 | |
|---|
| | 2193 | p_args.p_atom = NULL; |
|---|
| 2191 | 2194 | |
|---|
| 2192 | 2195 | p_vout->p_sys->b_net_wm_state_fullscreen = VLC_FALSE; |
|---|
| … | … | |
| 2204 | 2207 | &net_wm_supported, |
|---|
| 2205 | 2208 | &i_format, &i_items, &i_bytesafter, |
|---|
| 2206 | | (unsigned char **)(intptr_t)&p_args ); |
|---|
| | 2209 | (unsigned char **)&p_args ); |
|---|
| 2207 | 2210 | |
|---|
| 2208 | 2211 | if( i_ret != Success || i_items == 0 ) return; |
|---|
| … | … | |
| 2225 | 2228 | for( i = 0; i < i_items; i++ ) |
|---|
| 2226 | 2229 | { |
|---|
| 2227 | | if( p_args[i] == p_vout->p_sys->net_wm_state_fullscreen ) |
|---|
| | 2230 | if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_fullscreen ) |
|---|
| 2228 | 2231 | { |
|---|
| 2229 | 2232 | msg_Dbg( p_vout, |
|---|
| … | … | |
| 2231 | 2234 | p_vout->p_sys->b_net_wm_state_fullscreen = VLC_TRUE; |
|---|
| 2232 | 2235 | } |
|---|
| 2233 | | else if( p_args[i] == p_vout->p_sys->net_wm_state_above ) |
|---|
| | 2236 | else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_above ) |
|---|
| 2234 | 2237 | { |
|---|
| 2235 | 2238 | msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_ABOVE" ); |
|---|
| 2236 | 2239 | p_vout->p_sys->b_net_wm_state_above = VLC_TRUE; |
|---|
| 2237 | 2240 | } |
|---|
| 2238 | | else if( p_args[i] == p_vout->p_sys->net_wm_state_below ) |
|---|
| | 2241 | else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_below ) |
|---|
| 2239 | 2242 | { |
|---|
| 2240 | 2243 | msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_BELOW" ); |
|---|
| 2241 | 2244 | p_vout->p_sys->b_net_wm_state_below = VLC_TRUE; |
|---|
| 2242 | 2245 | } |
|---|
| 2243 | | else if( p_args[i] == p_vout->p_sys->net_wm_state_stays_on_top ) |
|---|
| | 2246 | else if( p_args.p_atom[i] == p_vout->p_sys->net_wm_state_stays_on_top ) |
|---|
| 2244 | 2247 | { |
|---|
| 2245 | 2248 | msg_Dbg( p_vout, |
|---|
| … | … | |
| 2249 | 2252 | } |
|---|
| 2250 | 2253 | |
|---|
| 2251 | | XFree( p_args ); |
|---|
| | 2254 | XFree( p_args.p_atom ); |
|---|
| 2252 | 2255 | } |
|---|
| 2253 | 2256 | |
|---|
| rd1c0b83 |
rb5c2d45 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: effects.c,v 1.10 2003/12/04 16:02:54 sam Exp $ |
|---|
| | 5 | * $Id$ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Cl�nt Stenac <zorglub@via.ecp.fr> |
|---|
| … | … | |
| 147 | 147 | for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; ) |
|---|
| 148 | 148 | { |
|---|
| 149 | | float f_in = *p_buffl + 384.0; |
|---|
| 150 | | int32_t i_in; |
|---|
| 151 | | i_in = *(int32_t *)(intptr_t)&f_in; |
|---|
| 152 | | if(i_in > 0x43c07fff ) * p_buffs = 32767; |
|---|
| 153 | | else if ( i_in < 0x43bf8000 ) *p_buffs = -32768; |
|---|
| 154 | | else *p_buffs = i_in - 0x43c00000; |
|---|
| | 149 | union { float f; int32_t i; } u; |
|---|
| | 150 | u.f = *p_buffl + 384.0; |
|---|
| | 151 | if(u.i > 0x43c07fff ) * p_buffs = 32767; |
|---|
| | 152 | else if ( u.i < 0x43bf8000 ) *p_buffs = -32768; |
|---|
| | 153 | else *p_buffs = u.i - 0x43c00000; |
|---|
| 155 | 154 | |
|---|
| 156 | 155 | p_buffl++ ; p_buffs++ ; |
|---|