php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
conv.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
7#ifndef LEXBOR_CONV_H
8#define LEXBOR_CONV_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14
15#include "lexbor/core/base.h"
16
17
18LXB_API size_t
19lexbor_conv_float_to_data(double num, lxb_char_t *buf, size_t len);
20
21LXB_API size_t
22lexbor_conv_long_to_data(long num, lxb_char_t *buf, size_t len);
23
24LXB_API size_t
25lexbor_conv_int64_to_data(int64_t num, lxb_char_t *buf, size_t len);
26
27LXB_API double
29
30LXB_API unsigned long
31lexbor_conv_data_to_ulong(const lxb_char_t **data, size_t length);
32
33LXB_API long
34lexbor_conv_data_to_long(const lxb_char_t **data, size_t length);
35
36LXB_API unsigned
37lexbor_conv_data_to_uint(const lxb_char_t **data, size_t length);
38
39LXB_API size_t
40lexbor_conv_dec_to_hex(uint32_t number, lxb_char_t *out, size_t length);
41
42lxb_inline long
44{
45 if (number > (double) LONG_MAX) {
46 return LONG_MAX;
47 }
48
49 if (number < (double) LONG_MIN) {
50 return -LONG_MAX;
51 }
52
53 return (long) number;
54}
55
56
57#ifdef __cplusplus
58} /* extern "C" */
59#endif
60
61#endif /* LEXBOR_CONV_H */
size_t len
Definition apprentice.c:174
LXB_API size_t lexbor_conv_int64_to_data(int64_t num, lxb_char_t *buf, size_t len)
Definition conv.c:28
LXB_API unsigned long lexbor_conv_data_to_ulong(const lxb_char_t **data, size_t length)
Definition conv.c:207
LXB_API double lexbor_conv_data_to_double(const lxb_char_t **start, size_t len)
Definition conv.c:90
LXB_API long lexbor_conv_data_to_long(const lxb_char_t **data, size_t length)
Definition conv.c:236
LXB_API size_t lexbor_conv_dec_to_hex(uint32_t number, lxb_char_t *out, size_t length)
Definition conv.c:308
LXB_API size_t lexbor_conv_long_to_data(long num, lxb_char_t *buf, size_t len)
Definition conv.c:22
LXB_API size_t lexbor_conv_float_to_data(double num, lxb_char_t *buf, size_t len)
Definition conv.c:16
lxb_inline long lexbor_conv_double_to_long(double number)
Definition conv.h:43
LXB_API unsigned lexbor_conv_data_to_uint(const lxb_char_t **data, size_t length)
Definition conv.c:279
#define LXB_API
Definition def.h:48
buf start
Definition ffi.c:4687
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
zend_constant * data
#define lxb_inline
Definition types.h:21
unsigned char lxb_char_t
Definition types.h:27
#define LONG_MAX
#define LONG_MIN
out($f, $s)