This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of SmartSNMP | |
* Copyright (C) 2014, Credo Semiconductor Inc. | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MSG_CODEC(ACTION) \ | |
ACTION( UNKNOWN, ""/* unknown */ ) \ | |
ACTION( REQ_GET, "get " ) \ | |
ACTION( REQ_GETS, "gets " ) \ | |
ACTION( REQ_DELETE, "delete " ) \ | |
ACTION( REQ_CAS, "cas " ) \ | |
ACTION( REQ_SET, "set " ) \ | |
ACTION( REQ_ADD, "add " ) \ | |
ACTION( REQ_REPLACE, "replace " ) \ | |
ACTION( REQ_APPEND, "append " ) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Date: 2014-8-1 | |
Licence: MIT | |
Author: <[email protected]> | |
<[email protected]> | |
]] | |
--[[ | |
module_relation table | |
key -- module name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int binary_search_first_position(int *A, int n, int target) | |
{ | |
int low = -1, high = n; | |
assert(A != NULL && n >= 0); | |
while (low + 1 < high) | |
{ | |
int mid = (low + high) >> 1; | |
if (A[mid] < target) | |
low = mid; | |
else |
NewerOlder