Skip to content

Commit 515904d

Browse files
committed
Fixed asserts, simplified bounds check
1 parent 0be7017 commit 515904d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

kernels/common/buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ namespace embree
256256
throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"item count too large");
257257
}
258258

259-
if (offset_in > 0 && offset_in >= buffer_in->numBytes) {
259+
if (offset_in > buffer_in->numBytes) {
260260
throw_RTCError(RTC_ERROR_INVALID_ARGUMENT, "offset too large");
261261
}
262262

kernels/common/scene_grid_mesh.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ namespace embree
155155
__forceinline unsigned int getNumQuads(const size_t gridID) const
156156
{
157157
const Grid& g = grid(gridID);
158-
assert(g.resX > maxGridRes);
159-
assert(g.resY > maxGridRes);
158+
assert(g.resX <= maxGridRes);
159+
assert(g.resY <= maxGridRes);
160160
return (unsigned int) max((int)1,((int)g.resX-1) * ((int)g.resY-1));
161161
}
162162

163163
__forceinline unsigned int getNumSubGrids(const size_t gridID) const
164164
{
165165
const Grid& g = grid(gridID);
166-
assert(g.resX > maxGridRes);
167-
assert(g.resY > maxGridRes);
166+
assert(g.resX <= maxGridRes);
167+
assert(g.resY <= maxGridRes);
168168
return max((unsigned int)1,((unsigned int)g.resX >> 1) * ((unsigned int)g.resY >> 1));
169169
}
170170

0 commit comments

Comments
 (0)