Revision ae529ddb

View differences:

libavutil/common.h
335 335
        }\
336 336
    }
337 337

  
338
/*!
339
 * \def PUT_UTF16(val, tmp, PUT_16BIT)
340
 * Converts a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
341
 * \param val is an input-only argument and should be of type uint32_t. It holds
342
 * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
343
 * val is given as a function it is executed only once.
344
 * \param tmp is a temporary variable and should be of type uint16_t. It
345
 * represents an intermediate value during conversion that is to be
346
 * output by PUT_16BIT.
347
 * \param PUT_16BIT writes the converted UTF-16 data to any proper destination
348
 * in desired endianness. It could be a function or a statement, and uses tmp
349
 * as the input byte.  For example, PUT_BYTE could be "*output++ = tmp;"
350
 * PUT_BYTE will be executed 1 or 2 times depending on input character.
351
 */
352
#define PUT_UTF16(val, tmp, PUT_16BIT)\
353
    {\
354
        uint32_t in = val;\
355
        if (in < 0x10000) {\
356
            tmp = in;\
357
            PUT_16BIT\
358
        } else {\
359
            tmp = 0xD800 | ((in - 0x10000) >> 10);\
360
            PUT_16BIT\
361
            tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
362
            PUT_16BIT\
363
        }\
364
    }\
365

  
366

  
367

  
338 368
#include "mem.h"
339 369

  
340 370
#ifdef HAVE_AV_CONFIG_H

Also available in: Unified diff