size

Why does an uint64_t needs more memory than 2 uint32_t's when used in a class? And how to prevent this?

余生颓废 提交于 2019-12-05 09:33:52
I have made the following code as an example. #include <iostream> struct class1 { uint8_t a; uint8_t b; uint16_t c; uint32_t d; uint32_t e; uint32_t f; uint32_t g; }; struct class2 { uint8_t a; uint8_t b; uint16_t c; uint32_t d; uint32_t e; uint64_t f; }; int main(){ std::cout << sizeof(class1) << std::endl; std::cout << sizeof(class2) << std::endl; std::cout << sizeof(uint64_t) << std::endl; std::cout << sizeof(uint32_t) << std::endl; } prints 20 24 8 4 So it's fairly simple to see that one uint64_t is as large as two uint32_t's, Why would class 2 have 4 extra bytes, if they are the same

emacs programmatically change window size

我与影子孤独终老i 提交于 2019-12-05 09:02:32
I would like to implement automatic collapse of compilation buffer to small size (but not close at a delete windows), such that upon successful compilation to window is shrunk to minimum size. get-buffer-create returns a buffer. how can I shrink-window on window associated with that buffer? also, is there a way to store previous window size? It is my first foray into emacs lisp programming, thank you for your help. I believe there are two ways to solve this problem. The first is to use the hook `'compilation-finish-functions', which is: [A list of f]unctions to call when a compilation process

Custom byte size?

妖精的绣舞 提交于 2019-12-05 08:57:50
So, you know how the primitive of type char has the size of 1 byte? How would I make a primitive with a custom size? So like instead of an in int with the size of 4 bytes I make one with size of lets say 16. Is there a way to do this? Is there a way around it? Normally you'd just make a struct that represents the data in which you're interested. If it's 16 bytes of data, either it's an aggregate of a number of smaller types or you're working on a processor that has a native 16-byte integral type. If you're trying to represent extremely large numbers, you may need to find a special library that

学习数据结构Day1

一世执手 提交于 2019-12-05 08:50:35
数据结构的分类: 线性结构 数组;栈;队列;链表;哈希表;。。。 树结构 二叉树;二分查找树;AVL;红黑树;Treap;Splay;堆;栈;Trie;线段树;K-D树;并查集;哈夫曼 树;。。。 图结构 邻接矩阵;邻接表;。。。 对于数据结构的重要性,自然不必多说,直接开始学习! 数组 基础:把数据码成一排进行存放。 public class ArrayBasic { public static void main(String[] args) { int[] arr = new int[10]; // for (int i = 0; i < arr.length; i++) { // arr[i] = i; // } int[] score = new int[]{100,66,99}; for (int i = 0; i < score.length; i++) { System.out.println(score[i]); } for (int i : score) { System.out.println(i); } score[0] = 98; for (int i : score) { System.out.println(i); } } } 这是一个最基础的对于数组的代码演示。 其中数组的索引既可以有语意,也可以没语义。 数组最大的好处:快速查询

Reducing GCC target EXE code size?

走远了吗. 提交于 2019-12-05 08:36:46
When I compiled a no-op program: int main(void) { return 0; } with various compilers: GCC (similar result to LLVM as well): Gave a 10-KiB executable (compiled with -s ) Sections: .CRT , .bss , .data , .idata , .rdata , .text , .tls Depends on msvcrt.dll and kernel32.dll MSVC 2010: Gave a 5.5 KiB executable (compiled with /MD /Ox ) Sections: .data , .rdata , .reloc , .text Depends on msvcr100.dll and kernel32.dll Could have been further reduced by merging .rdata with .text Windows Driver Kit 7.1: Gave a 6.5 KiB executable (compiled with /MD /Ox , linked with msvcrt_winxp.obj to allow it to run

将list 转成带分页的参数用map 返回给前端

两盒软妹~` 提交于 2019-12-05 08:32:51
开发过程中 查询的列表不能分页查询 但是前端需要分页的参数 没办法 只能这样搞 把list 转成page参数的数据返回给前端 public class ListPageUtil { public static <T> Map<String, Object> pageBySubList(List<T> list, int pagesize, int currentPage) { currentPage = currentPage+1; int totalcount = list.size(); int pagecount = 0; List<T> subList; Map<String, Object> map =new HashMap<String, Object>(); int m = totalcount % pagesize; if (m > 0) { pagecount = totalcount / pagesize + 1; } else { pagecount = totalcount / pagesize; } if (m == 0) { subList = list.subList((currentPage - 1) * pagesize, pagesize * (currentPage)); } else { if (currentPage ==

HTML5 Video Controls - make larger?

被刻印的时光 ゝ 提交于 2019-12-05 08:28:35
I know you can customize the video controls to make your own buttons/layout, but is there any way I can just make the default controls larger? Not in a cross-browser way, but the controls are built with Shadow DOM elements. In Chrome, at least, you can enable Show Shadow DOM in the dev tools settings, inspect the video player controls, and glean the CSS that you'd need to supply to affect these elements (in webkit browsers). Sorry, not sure offhand what the support is in other browsers for inspecting and styling Shadow DOM stuff. pesho hristov You can use pseudo-classes, e.g. video::-webkit

Default font size of JavaFX under Linux is larger as on Windows

▼魔方 西西 提交于 2019-12-05 07:15:19
I noticed that the default font is way larger in JavaFX under Linux (Ubuntu XY) as it is under Windows. Since screen space is sometimes quite limited i would like to have it ideally the same size as it is under Windows. Is there a simple way to enforce the same default size / the same DPI value? LuCG In short, font rendering will depend of the OS. So you will have more/less pixels for the same word depending of the OS where java is running. One good practice is to use: USE_COMPUTED_SIZE as much as possible to avoid problems and let your app just fit by it self depending on the size of the

Play video not in full screen mode

China☆狼群 提交于 2019-12-05 07:12:37
问题 First, excuse my english :) I've read on apple developer website that video playback provides by the framework supports only full screen mode. I will need to develop an application where video can be played in reduce screen mode. I've see that Orange TV make something which looks like what i need to do. http://img218.imageshack.us/img218/1228/tvplayerorange.jpg http://img218.imageshack.us/img218/1228/tvplayerorange.jpg http://img218.imageshack.us/img218/1228/tvplayerorange.jpg The application

xcode iphone simulator view smaller than storyboard

梦想与她 提交于 2019-12-05 06:26:58
I'm having issues with the size of my story board and the size of the actual display on the iPhone Simulator. Any ideas? Your simulator is proper. No need to resize it. You only need to follow these steps 1. go to nib/storyboard. 2. click on view 3. check menu on right side 4. go to 4th tab 5. Expand Simulated Metrics 6. Check Status bar is equal to Default 7. Top Bar & Bottom Bar are equal to None & None respectively. Enjoy Programming! There are many correct answers to this question, but the thing is that you can do that by pressing a single button. I had the same problem and this is how I