unsigned

how can i use jpeg_mem_src, jpeg_mem_dest in libjpeg-turbo?

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: libjpeg8 include are those two functions, but in libjpeg-turbo has the following: //jconfig.h #define JPEG_LIB_VERSION 62 ... //jpeglib.h #if JPEG_LIB_VERSION >= 80 /* Data source and destination managers: memory buffers. */ EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, unsigned char ** outbuffer, unsigned long * outsize)); EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, unsigned char * inbuffer, unsigned long insize)); #endif if i try to use "JPEG_LIB_VERSION 80" i'll get the following: error LNK2019: unresolved external

When should I just use “int” versus more sign-specific or size-specific types?

不羁岁月 提交于 2019-12-03 01:17:56
问题 I have a little VM for a programming language implemented in C. It supports being compiled under both 32-bit and 64-bit architectures as well as both C and C++. I'm trying to make it compile cleanly with as many warnings enabled as possible. When I turn on CLANG_WARN_IMPLICIT_SIGN_CONVERSION , I get a cascade of new warnings. I'd like to have a good strategy for when to use int versus either explicitly unsigned types, and/or explicitly sized ones. So far, I'm having trouble deciding what that

How to create random dynamic 2D arrays in SystemVerilog?

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know how to create a random dynamic array in SystemVerilog: class packet; rand int unsigned len; rand byte data[]; constraint size_con { len < 2000; data.size = len; } endclass: packet but I can't figure out how to use random 2d dynamic array? class video_frame; rand int unsigned width; rand int unsigned height; rand int unsigned data[][]; constraint size_con { width >= 8; width <= 4096; height >= 8; height >= 2048; // How to constraint data.size to be [height, width] } endclass: video_frame; 回答1: You need to realize that SystemVerilog has

Cannot link OpenCV Android inside Qt

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried to use OpenCV with Android inside Qt, but I cannot successfully link it inside Qt, I get some undefined reference errors to the side libraries (like libjpeg, libtegra_hal etc.). I used this SO answer as a reference guide. This is my .pro file - INCLUDEPATH += "$$PWD/../../External-Libraries/opencv-android/sdk/native/jni/include" android { # 3rd party libs LIBS += \ -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/3rdparty/libs/armeabi-v7a"\ -llibtiff\ -llibjpeg\ -llibjasper\ -llibpng\ -llibwebp\ -lIlmImf\ -ltbb\ -ltegra

Mac Error: Undefined symbols for architecture x86_64

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to install the MIT Language Modeling Toolkit . I've installed the dependencies, and ./autogen.sh works fine. However, when I compile with make , I get the error below. I am running OSX 10.10.3. Undefined symbols for architecture x86_64: "std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned long, unsigned long) const", referenced from: std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to<unsigned long

Why is it still possible to insert a foreign key that doesn&#039;t exist?

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: mysql> create table products(id integer unsigned auto_increment primary key); Query OK, 0 rows affected (0.05 sec) mysql> CREATE TABLE orders ( -> id integer PRIMARY KEY auto_increment, -> product_id integer REFERENCES products (id), -> quantity integer, -> INDEX product_id_idx (product_id) -> ); Query OK, 0 rows affected (0.05 sec) mysql> insert into orders(product_id,quantity) value(1,1); Query OK, 1 row affected (0.00 sec) Since product 1 doesn't exist,the insert statement is supposed to fail,but in fact not. Why? 回答1: You should

Block reduction in CUDA

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to do reduction in CUDA and I am really a newbie. I am currently studying a sample code from NVIDIA. I guess I am really not sure how to set up the block size and grid size, especially when my input array is larger ( 512 X 512 ) than a single block size. Here is the code. template < unsigned int blockSize > __global__ void reduce6 ( int * g_idata , int * g_odata , unsigned int n ) { extern __shared__ int sdata []; unsigned int tid = threadIdx . x ; unsigned int i = blockIdx . x *( blockSize * 2 ) + tid ; unsigned int

使用无锁队列(环形缓冲区)注意事项

匿名 (未验证) 提交于 2019-12-03 00:39:02
环形缓冲区是生产者和消费者模型中常用的数据结构。生产者将数据放入数组的尾端,而消费者从数组的另一端移走数据,当达到数组的尾部时,生产者绕回到数组的头部。如果只有一个生产者和一个消费者,那么就可以做到免锁访问环形缓冲区(Ring Buffer)。写入索引只允许生产者访问并修改,只要写入者在更新索引之前将新的值保存到缓冲区中,则读者将始终看到一致的数据结构。同理,读取索引也只允许消费者访问并修改。 环形缓冲区实现原理图 如图所示,当读者和写者指针相等时,表明缓冲区是空的,而只要写入指针在读取指针后面时,表明缓冲区已满。 清单 环形缓冲区实现代码 /* * __kfifo_put - puts some data into the FIFO, no locking version * Note that with only one concurrent reader and one concurrent * writer, you don‘t need extra locking to use these functions. */ unsigned int __kfifo_put(struct kfifo *fifo, unsigned char *buffer, unsigned int len) { unsigned int l; len = min(len, fifo->size

c++学习笔记(一)---数据类型和对象

匿名 (未验证) 提交于 2019-12-03 00:39:02
c++简介: c++是面向对象的编程,特点可以概括为4个字:封装、抽象、继承、多态,把对象的属性和方法集合成一个独立的系统单位,尽可能隐藏对象的内部细节,对具体的问题进行概括的过程,子类对象拥有与基类相同的全部属性和方法,子类继承基类的属性和行为后,可以具有不同的数据类型和表现行为等特性。 常用代码、函数介绍: cout:console out(控制台输出) 数据类型:数组、指针、结构: 一个数组可以把很多同类型的数值存在一个变量名下 e.g #include <iostream> #define ITEM 10 #define input_add() int main() { //const unsigned short ITEM = 10; int num[ITEM]; std::cout << "please input" << ITEM << "int number!\n\n"; input_add(); return 0; } void input_add() { for(int i=0; i<ITEM; i++) { std::cout << "please input" << i+1 << "number\n"; std::cin >> num[i] while(!(std::cin >> num[i])) { std::cin.clear(); std::cin

scatter/gather I/O

匿名 (未验证) 提交于 2019-12-03 00:38:01
发散/汇聚映射 int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction); 各参数含义如下: dev:设备数据结构指针 sg:缓冲区列表的第一个缓冲区的指针 nets:sg中有多少个缓冲区 direction:数据流动方向 该函数的返回值是成功映射了多少个缓冲区。如果在分散/汇聚列表中一些缓冲的物理地址或虚拟地址相邻的,且IOMMU可以将它们映射成单个内存块,则返回值可能比输入值nents小。 数据结构scatterlist包含了每个缓冲区的信息,其定义如下: struct scatterlist { #ifdef CONFIG_DEBUG_SG unsigned long sg_magic; #endif unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; #ifdef CONFIG_NEED_SG_DMA_LENGTH unsigned int dma_length; #endif }; 注意如果sg已经映射过了,则不能再对其进行映射,再次映射会损坏sg中的信息。对于sg中的每个缓冲,该函数会正确的为