An upcoming commit will make use of this feature.
Signed-off-by: Ben Pfaff <blp@nicira.com>
/*
- * Copyright (c) 2008, 2009, 2011 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2011, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
/* Scans 'bitmap' from bit offset 'start' to 'end', excluding 'end' itself.
- * Returns the bit offset of the lowest-numbered bit set to 1, or 'end' if
- * all of the bits are set to 0. */
+ * Returns the bit offset of the lowest-numbered bit set to 'target', or 'end'
+ * if all of the bits are set to '!target'. */
size_t
-bitmap_scan(const unsigned long int *bitmap, size_t start, size_t end)
+bitmap_scan(const unsigned long int *bitmap, bool target,
+ size_t start, size_t end)
{
/* XXX slow */
size_t i;
for (i = start; i < end; i++) {
- if (bitmap_is_set(bitmap, i)) {
+ if (bitmap_is_set(bitmap, i) == target) {
break;
}
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void bitmap_set_multiple(unsigned long *, size_t start, size_t count,
bool value);
bool bitmap_equal(const unsigned long *, const unsigned long *, size_t n);
-size_t bitmap_scan(const unsigned long int *, size_t start, size_t end);
+size_t bitmap_scan(const unsigned long int *, bool target,
+ size_t start, size_t end);
size_t bitmap_count1(const unsigned long *, size_t n);
#define BITMAP_FOR_EACH_1(IDX, SIZE, BITMAP) \
- for ((IDX) = bitmap_scan(BITMAP, 0, SIZE); (IDX) < (SIZE); \
- (IDX) = bitmap_scan(BITMAP, (IDX) + 1, SIZE))
+ for ((IDX) = bitmap_scan(BITMAP, 1, 0, SIZE); (IDX) < (SIZE); \
+ (IDX) = bitmap_scan(BITMAP, 1, (IDX) + 1, SIZE))
#endif /* bitmap.h */
/*
- * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct ds;
struct match;
+struct mf_field;
struct mf_subfield;
struct ofpact_reg_move;
struct ofpact_reg_load;
-/* Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ds_put_format(out, "%s row, with UUID "UUID_FMT", ",
title, UUID_ARGS(ovsdb_row_get_uuid(row)));
if (!row->txn_row
- || bitmap_scan(row->txn_row->changed, 0, n_columns) == n_columns) {
+ || bitmap_scan(row->txn_row->changed, 1, 0, n_columns) == n_columns) {
ds_put_cstr(out, "existed in the database before this "
"transaction and was not modified by the transaction.");
} else if (!row->txn_row->old) {
}
}
- if (bitmap_scan(port_num_bitmap, 0, STP_MAX_PORTS) != STP_MAX_PORTS
+ if (bitmap_scan(port_num_bitmap, 1, 0, STP_MAX_PORTS) != STP_MAX_PORTS
&& port_num_counter) {
VLOG_ERR("bridge %s: must manually configure all STP port "
"IDs or none, disabling", br->name);
sset_destroy(&splinter_ifaces);
- if (bitmap_scan(splinter_vlans, 0, 4096) >= 4096) {
+ if (bitmap_scan(splinter_vlans, 1, 0, 4096) >= 4096) {
free(splinter_vlans);
return NULL;
}