#include <stdint.h>
uint16_t date2short (int day, int month, int year) {
if (day > 31 || day < 1 || month > 12 || month < 1 || year > 127 || year < 0)
return 0;
uint16_t result = 0;
result |= day << 11;
result |= month << 7;
result |= year;
return result;
}
标签:int,month,按位,整型,year,C语言,day,result
From: https://www.cnblogs.com/yuyanc/p/17682066.html