rework langinfo code for ABI compat and for use by time code
[musl] / src / stdio / fwide.c
1 #include "stdio_impl.h"
2
3 #define SH (8*sizeof(int)-1)
4 #define NORMALIZE(x) ((x)>>SH | -((-(x))>>SH))
5
6 int fwide(FILE *f, int mode)
7 {
8         FLOCK(f);
9         if (!f->mode) mode = f->mode = NORMALIZE(mode);
10         FUNLOCK(f);
11         return mode;
12 }