File: pr64460_1.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A8-2019-q3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 571,828 kB
  • sloc: ansic: 2,937,651; cpp: 881,644; ada: 597,189; makefile: 65,528; asm: 56,499; xml: 46,621; exp: 24,747; sh: 19,684; python: 7,256; pascal: 4,370; awk: 3,497; perl: 2,695; yacc: 316; ml: 285; f90: 234; lex: 198; objc: 194; haskell: 119
file content (69 lines) | stat: -rw-r--r-- 1,820 bytes parent folder | download | duplicates (10)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* { dg-do compile } */
/* { dg-options "-O2 -mtune=xscale" } */

typedef unsigned int size_t;
typedef short unsigned int __uint16_t;
typedef long unsigned int __uint32_t;
typedef unsigned int __uintptr_t;
typedef __uint16_t uint16_t ;
typedef __uint32_t uint32_t ;
typedef __uintptr_t uintptr_t;
typedef uint32_t Objects_Id;
typedef uint16_t Objects_Maximum;
typedef struct { } Objects_Control;

static __inline__ void *_Addresses_Align_up (void *address, size_t alignment)
{
	uintptr_t mask = alignment - (uintptr_t)1;
	return (void*)(((uintptr_t)address + mask) & ~mask);
}

typedef struct {
	Objects_Id minimum_id;
	Objects_Maximum maximum;
	_Bool
		auto_extend;
	Objects_Maximum allocation_size;
	void **object_blocks;
} Objects_Information;

extern uint32_t _Objects_Get_index (Objects_Id);
extern void** _Workspace_Allocate (size_t);

void _Objects_Extend_information (Objects_Information *information)
{
	uint32_t block_count;
	uint32_t minimum_index;
	uint32_t maximum;
	size_t block_size;
	_Bool
		do_extend =
		minimum_index = _Objects_Get_index( information->minimum_id );
	if ( information->object_blocks ==
			((void *)0)
	   )
		block_count = 0;
	else {
		block_count = information->maximum / information->allocation_size;
	}
	if ( do_extend ) {
		void **object_blocks;
		uintptr_t object_blocks_size;
		uintptr_t inactive_per_block_size;
		object_blocks_size = (uintptr_t)_Addresses_Align_up(
				(void*)(block_count * sizeof(void*)),
				8
				);
		inactive_per_block_size =
			(uintptr_t)_Addresses_Align_up(
					(void*)(block_count * sizeof(uint32_t)),
					8
					);
		block_size = object_blocks_size + inactive_per_block_size +
			((maximum + minimum_index) * sizeof(Objects_Control *));
		if ( information->auto_extend ) {
			object_blocks = _Workspace_Allocate( block_size );
		} else {
		}
	}
}