File: native_library.cc

package info (click to toggle)
kodi-inputstream-adaptive 2.6.14%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,036 kB
  • sloc: cpp: 53,019; ansic: 492; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "native_library.h"

namespace base {

	const char *int2char(int value, char* buffer)
	{
		const char *result = buffer;
		unsigned int buffer_pos = 0;

		if (value < 0) {
			buffer[buffer_pos++] = '-';
			value = -value;
		}

		int number_of_digits = 0;
		int t = value;
		do {
			++number_of_digits;
		} while (t /= 10);

		buffer_pos += number_of_digits;

		do {
			int last_digit = value % 10;
			buffer[--buffer_pos] = '0' + last_digit;
			value /= 10;
		} while (value);
		return result;
	}
} //namespace