Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: src/trusted/validator_ragel/unreviewed/validator-x86_32.rl

Issue 10031039: Add ragel validator to SCONS (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/trusted/validator_ragel/unreviewed/validator-x86_32.rl
===================================================================
--- src/trusted/validator_ragel/unreviewed/validator-x86_32.rl (revision 8217)
+++ src/trusted/validator_ragel/unreviewed/validator-x86_32.rl (working copy)
@@ -5,24 +5,22 @@
*/
#include <assert.h>
-#include <elf.h>
-#include <inttypes.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "validator.h"
-#undef TRUE
-#define TRUE 1
+#include "native_client/src/shared/utils/types.h"
+#include "native_client/src/trusted/validator_ragel/unreviewed/validator.h"
-#undef FALSE
-#define FALSE 0
+#if defined(_MSC_VER)
+#define inline __inline
+#endif
#define check_jump_dest \
if ((jump_dest & bundle_mask) != bundle_mask) { \
if (jump_dest >= size) { \
- printf("direct jump out of range: %zx\n", jump_dest); \
+ printf("direct jump out of range: %"NACL_PRIxS"\n", jump_dest); \
result = 1; \
goto error_detected; \
} else { \
@@ -115,8 +113,8 @@
static const int kBitsPerByte = 8;
-static inline uint8_t *BitmapAllocate(uint32_t indexes) {
- uint32_t byte_count = (indexes + kBitsPerByte - 1) / kBitsPerByte;
+static inline uint8_t *BitmapAllocate(size_t indexes) {
+ size_t byte_count = (indexes + kBitsPerByte - 1) / kBitsPerByte;
uint8_t *bitmap = malloc(byte_count);
if (bitmap != NULL) {
memset(bitmap, 0, byte_count);
@@ -124,15 +122,15 @@
return bitmap;
}
-static inline int BitmapIsBitSet(uint8_t *bitmap, uint32_t index) {
+static inline int BitmapIsBitSet(uint8_t *bitmap, size_t index) {
return (bitmap[index / kBitsPerByte] & (1 << (index % kBitsPerByte))) != 0;
}
-static inline void BitmapSetBit(uint8_t *bitmap, uint32_t index) {
+static inline void BitmapSetBit(uint8_t *bitmap, size_t index) {
bitmap[index / kBitsPerByte] |= 1 << (index % kBitsPerByte);
}
-static inline void BitmapClearBit(uint8_t *bitmap, uint32_t index) {
+static inline void BitmapClearBit(uint8_t *bitmap, size_t index) {
bitmap[index / kBitsPerByte] &= ~(1 << (index % kBitsPerByte));
}
« no previous file with comments | « src/trusted/validator_ragel/unreviewed/validator-test.c ('k') | src/trusted/validator_ragel/unreviewed/validator-x86_64.rl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698