summaryrefslogtreecommitdiff
path: root/src/libstddjb/tai_u64.c
blob: 9132ff36c30a05f466e0fd4789298521ab48d2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

/* OpenBSD needs that for EOVERFLOW. wtfbsdseriously */
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif

#include <errno.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>

int tai_u64 (tai_t *t, uint64 u)
{
  if (u & ((uint64)1 << 63)) return (errno = EOVERFLOW, 0) ;
  t->x = u ;
  return 1 ;
}