| 3837 | } |
| 3838 | |
| 3839 | uchar* SparseMat::ptr(int i0, bool createMissing, size_t* hashval) |
| 3840 | { |
| 3841 | CV_Assert( hdr && hdr->dims == 1 ); |
| 3842 | size_t h = hashval ? *hashval : hash(i0); |
| 3843 | size_t hidx = h & (hdr->hashtab.size() - 1), nidx = hdr->hashtab[hidx]; |
| 3844 | uchar* pool = &hdr->pool[0]; |
| 3845 | while( nidx != 0 ) |
| 3846 | { |
| 3847 | Node* elem = (Node*)(pool + nidx); |
| 3848 | if( elem->hashval == h && elem->idx[0] == i0 ) |
| 3849 | return &value<uchar>(elem); |
| 3850 | nidx = elem->next; |
| 3851 | } |
| 3852 | |
| 3853 | if( createMissing ) |
| 3854 | { |
| 3855 | int idx[] = { i0 }; |
| 3856 | return newNode( idx, h ); |
| 3857 | } |
| 3858 | return 0; |
| 3859 | } |
| 3860 | |
| 3861 | uchar* SparseMat::ptr(int i0, int i1, bool createMissing, size_t* hashval) |
| 3862 | { |
no test coverage detected