Skip to content

Commit 0a15475

Browse files
committed
utils/pspRT header updates for macos compatibility
1 parent a09739a commit 0a15475

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

cpp/include/utils/pspRTmem.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@
3737

3838
#ifndef PBRT_CORE_MEMORY_H
3939
#define PBRT_CORE_MEMORY_H
40-
//#include "stdafx.h"
41-
#include <cstdint>
42-
#include <malloc.h>
40+
4341
#define PBRT_L1_CACHE_LINE_SIZE 64
4442

45-
// core/memory.h*
46-
//#include "pbrt.h"
47-
//#include "parallel.h"
43+
#include <stdint.h>
44+
#include <stdlib.h>
45+
#include <algorithm>
4846
#include <list>
47+
#include <utility>
4948

5049
// Memory Declarations
5150
#define ARENA_ALLOC(arena, Type) new ((arena).Alloc(sizeof(Type))) Type

cpp/raycast/pspRTmem.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@
3030
3131
*/
3232

33-
//#include "stdafx.h"
34-
35-
// core/memory.cpp*
33+
#include <cstdlib>
3634
#include "utils/pspRTmem.h"
3735

3836
// Memory Allocation Functions
3937
void *AllocAligned(size_t size)
4038
{
4139
#if defined(PBRT_IS_WINDOWS)
4240
return _aligned_malloc(size, PBRT_L1_CACHE_LINE_SIZE);
43-
#elif defined(PBRT_IS_OPENBSD) || defined(PBRT_IS_OSX)
41+
#else
4442
void *ptr;
45-
if (posix_memalign(&ptr, PBRT_L1_CACHE_LINE_SIZE, size) != 0) ptr = nullptr;
43+
if (posix_memalign(&ptr, PBRT_L1_CACHE_LINE_SIZE, size) != 0) {
44+
ptr = nullptr;
45+
}
4646
return ptr;
47-
#else
48-
return memalign(PBRT_L1_CACHE_LINE_SIZE, size);
4947
#endif
5048
}
5149

0 commit comments

Comments
 (0)