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
/* | |
* The binary gcd algorithm using iteration. | |
* Should be fairly fast. | |
* | |
* Put in the public domain by the author: | |
* | |
* Christian Stigen Larsen | |
* http://csl.sublevel3.org | |
*/ | |
int binary_gcd(int u, int v) |
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
#ifdef _MSC_VER | |
#include <intrin.h> | |
static inline int __builtin_ctz(uint32_t x) { | |
unsigned long ret; | |
_BitScanForward(&ret, x); | |
return (int)ret; | |
} | |
static inline int __builtin_ctzll(unsigned long long x) { |
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
// https://stackoverflow.com/questions/10956543/gcd-function-in-c-sans-cmath-library | |
template <typename Number> | |
Number GCD(Number u, Number v) | |
{ | |
while (v != 0) | |
{ | |
Number r = u % v; | |
u = v; | |
v = r; | |
} |
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
https://stackoverflow.com/questions/290227/java-system-currenttimemillis-equivalent-in-c-sharp | |
private static readonly DateTime Jan1st1970 = | |
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); | |
public static long currentTimeMillis() | |
{ | |
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; | |
} |
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
findContours: | |
https://docs.opencv.org/2.4.13.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html | |
approxPolyDP: | |
http://answers.opencv.org/question/71309/how-to-get-the-corners-of-rectangle-shapes/ | |
#include <opencv2/opencv.hpp> | |
#include "opencv2/core/core.hpp" |
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
https://gudanrkim.blogspot.com/2014/11/how-to-display-opencv-cvmat-to-mfc.html?_escaped_fragment_ | |
void cvShowImageHWND(HWND hwnd, const CvArr* arr) | |
{ | |
SIZE size = { 0, 0 }; | |
int channels = 0; |
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
// COM Data Types: | |
// https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/sak564ww(v=vs.90) | |
using System.Runtime.InteropServices; | |
namespace COMDLL | |
{ | |
[Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")] | |
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
public interface IMyclass |
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
#!/bin/bash | |
# thanks to http://stackoverflow.com/a/20743090 | |
# thanks to https://github.com/diogovk/c2nasm | |
# install objconv: https://github.com/vertis/objconv | |
# | |
# $1: source code | |
set -e | |
C_FILE="$1" | |
BASE_NAME="${C_FILE%.*}" |
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
https://aaronbloomfield.github.io/pdr/book/x86-64bit-ccc-chapter.pdf |
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
http://www.modernescpp.com/index.php/c-17-avoid-copying-with-std-string-view |