mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Make minor improvements
This commit is contained in:
parent
1fc91f3580
commit
b562d6fdb3
41 changed files with 1948 additions and 92 deletions
|
@ -17,16 +17,16 @@
|
|||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.h"
|
||||
#include "libc/runtime/valist.h"
|
||||
|
||||
static void *__va_arg_mem(struct __va *ap, unsigned long sz, unsigned align) {
|
||||
void *r = ap->overflow_arg_area;
|
||||
if (align > 8) r = (void *)(((unsigned long)r + 15) / 16 * 16);
|
||||
ap->overflow_arg_area = (void *)(((unsigned long)r + sz + 7) / 8 * 8);
|
||||
static void *__va_arg_mem(struct __va *ap, size_t sz, size_t align) {
|
||||
void *r = (void *)ROUNDUP((intptr_t)ap->overflow_arg_area, align);
|
||||
ap->overflow_arg_area = (void *)ROUNDUP((intptr_t)r + sz, 8);
|
||||
return r;
|
||||
}
|
||||
|
||||
void *__va_arg(struct __va *ap, unsigned long sz, unsigned align, unsigned k) {
|
||||
void *__va_arg(struct __va *ap, size_t sz, unsigned align, unsigned k) {
|
||||
void *r;
|
||||
switch (k) {
|
||||
case 0:
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct __va {
|
||||
unsigned int gp_offset;
|
||||
unsigned int fp_offset;
|
||||
uint32_t gp_offset;
|
||||
uint32_t fp_offset;
|
||||
void *overflow_arg_area;
|
||||
void *reg_save_area;
|
||||
};
|
||||
|
||||
void *__va_arg(struct __va *, unsigned long, unsigned, unsigned);
|
||||
void *__va_arg(struct __va *, size_t, unsigned, unsigned);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue